diff --git a/bin/enum_gen b/bin/enum_gen index 3a26013..91180e3 100755 Binary files a/bin/enum_gen and b/bin/enum_gen differ diff --git a/examples/leader_example/lib/leader_example/leader.ex b/examples/leader_example/lib/leader_example/leader.ex index f895dc1..44fad09 100644 --- a/examples/leader_example/lib/leader_example/leader.ex +++ b/examples/leader_example/lib/leader_example/leader.ex @@ -5,7 +5,7 @@ defmodule LeaderExample.Leader do require Logger - def start_link(datapath_id, args) do + def start_link([datapath_id, args]) do :locks_leader.start_link(__MODULE__, [datapath_id, args], []) end diff --git a/examples/learning_switch/lib/learning_switch/ofctl.ex b/examples/learning_switch/lib/learning_switch/ofctl.ex index 21b123f..bca155b 100644 --- a/examples/learning_switch/lib/learning_switch/ofctl.ex +++ b/examples/learning_switch/lib/learning_switch/ofctl.ex @@ -22,7 +22,7 @@ defmodule LearningSwitch.Ofctl do ] end - def start_link(datapath_id, args) do + def start_link([datapath_id, args]) do GenServer.start_link(__MODULE__, [datapath_id, args]) end diff --git a/examples/patch_panel/lib/patch_panel/openflow/controller.ex b/examples/patch_panel/lib/patch_panel/openflow/controller.ex index bbecf04..ac12470 100644 --- a/examples/patch_panel/lib/patch_panel/openflow/controller.ex +++ b/examples/patch_panel/lib/patch_panel/openflow/controller.ex @@ -26,7 +26,7 @@ defmodule PatchPanel.Openflow.Controller do end end - def start_link({datapath_id, _aux_id}, _start_args) do + def start_link([{datapath_id, _aux_id}, _start_args]) do GenServer.start_link(__MODULE__, [datapath_id]) end diff --git a/lib/tres/example_handler.ex b/lib/tres/example_handler.ex index 5e9a7b7..4f4dc21 100644 --- a/lib/tres/example_handler.ex +++ b/lib/tres/example_handler.ex @@ -10,7 +10,7 @@ defmodule Tres.ExampleHandler do conn_ref: nil end - def start_link(datapath, args) do + def start_link([datapath, args]) do GenServer.start_link(__MODULE__, [datapath, args]) end diff --git a/lib/tres/message_handler_sup.ex b/lib/tres/message_handler_sup.ex index b847bff..a027630 100644 --- a/lib/tres/message_handler_sup.ex +++ b/lib/tres/message_handler_sup.ex @@ -1,17 +1,16 @@ defmodule Tres.MessageHandlerSup do - use Supervisor + use DynamicSupervisor def start_link(cb_mod) do - Supervisor.start_link(__MODULE__, [cb_mod], name: __MODULE__) + DynamicSupervisor.start_link(__MODULE__, [cb_mod], name: __MODULE__) end - def init([cb_mod]) do - children = [worker(cb_mod, [], restart: :temporary, shutdown: 5000)] - supervise(children, strategy: :simple_one_for_one) + def init([_cb_mod]) do + DynamicSupervisor.init(strategy: :one_for_one) end def start_child({dpid, aux_id}) do - {_cb_mod, cb_args} = Tres.Utils.get_callback_module() - Supervisor.start_child(__MODULE__, [{dpid, aux_id}, cb_args]) + {cb_mod, cb_args} = Tres.Utils.get_callback_module() + DynamicSupervisor.start_child(__MODULE__, {cb_mod, [{dpid, aux_id}, cb_args]}) end end