Formatted and fix minor fixes
This commit is contained in:
parent
442fe2eaa4
commit
112e0ce4b5
4 changed files with 14 additions and 8 deletions
|
|
@ -993,20 +993,22 @@ defmodule Openflow.Enums do
|
||||||
to_int_fn_name = String.to_atom(enum_name <> "_to_int")
|
to_int_fn_name = String.to_atom(enum_name <> "_to_int")
|
||||||
to_atom_fn_name = String.to_atom(enum_name <> "_to_atom")
|
to_atom_fn_name = String.to_atom(enum_name <> "_to_atom")
|
||||||
|
|
||||||
for {key, value} <- enum_def do
|
for {key, _value} <- enum_def do
|
||||||
def to_int(unquote(key), unquote(String.to_atom(enum_name))) do
|
def to_int(unquote(key), unquote(String.to_atom(enum_name))) do
|
||||||
try do
|
try do
|
||||||
unquote(to_int_fn_name)(unquote(key))
|
unquote(to_int_fn_name)(unquote(key))
|
||||||
catch
|
catch
|
||||||
_ -> unquote(key)
|
:throw, _ -> unquote(key)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for {_key, value} <- enum_def do
|
||||||
def to_atom(unquote(value), unquote(String.to_atom(enum_name))) do
|
def to_atom(unquote(value), unquote(String.to_atom(enum_name))) do
|
||||||
try do
|
try do
|
||||||
unquote(to_atom_fn_name)(unquote(value))
|
unquote(to_atom_fn_name)(unquote(value))
|
||||||
catch
|
catch
|
||||||
_ -> unquote(value)
|
:throw, _ -> unquote(value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
defmodule Tres.Controller do
|
defmodule Tres.Controller do
|
||||||
def controller_helpers do
|
def controller_helpers do
|
||||||
quote do
|
quote do
|
||||||
import Tres.SwitchRegistry, only: [
|
import Tres.SwitchRegistry,
|
||||||
|
only: [
|
||||||
send_message: 2,
|
send_message: 2,
|
||||||
get_current_xid: 1
|
get_current_xid: 1
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -124,10 +124,12 @@ defmodule Tres.SecureChannel do
|
||||||
|
|
||||||
defp init_handler(state_data) do
|
defp init_handler(state_data) do
|
||||||
%State{datapath_id: dpid, aux_id: aux_id} = state_data
|
%State{datapath_id: dpid, aux_id: aux_id} = state_data
|
||||||
|
|
||||||
case MessageHandlerSup.start_child({dpid, aux_id}) do
|
case MessageHandlerSup.start_child({dpid, aux_id}) do
|
||||||
{:ok, pid} ->
|
{:ok, pid} ->
|
||||||
ref = Process.monitor(pid)
|
ref = Process.monitor(pid)
|
||||||
%{state_data | handler_pid: pid, handler_ref: ref}
|
%{state_data | handler_pid: pid, handler_ref: ref}
|
||||||
|
|
||||||
{:error, reason} ->
|
{:error, reason} ->
|
||||||
{:stop, reason}
|
{:stop, reason}
|
||||||
end
|
end
|
||||||
|
|
@ -210,6 +212,7 @@ defmodule Tres.SecureChannel do
|
||||||
%State{} = new_state_data ->
|
%State{} = new_state_data ->
|
||||||
start_periodic_idle_check()
|
start_periodic_idle_check()
|
||||||
{:keep_state, new_state_data}
|
{:keep_state, new_state_data}
|
||||||
|
|
||||||
{:stop, reason} ->
|
{:stop, reason} ->
|
||||||
close_connection({:handler_down, reason}, state_data)
|
close_connection({:handler_down, reason}, state_data)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue