Skip to content

Commit

Permalink
Do not expect set_technology to succeed
Browse files Browse the repository at this point in the history
  • Loading branch information
LostKobrakai committed Aug 22, 2022
1 parent b096bb8 commit 41b850a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
20 changes: 17 additions & 3 deletions lib/vintage_net/interface.ex
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ defmodule VintageNet.Interface do
# :configuring

@impl GenStateMachine
def handle_event(:info, {:commands_done, :ok}, :configuring, %State{} = data) do
def handle_event(:info, {:commands_done, :ok}, :configuring, %State{config: config} = data) do
# debug(data, ":configuring -> done success")
{new_data, actions} = reply_to_waiters(data)
new_data = %{new_data | command_runner: nil}
Expand All @@ -249,8 +249,22 @@ defmodule VintageNet.Interface do
data.config.restart_strategy,
data.config.child_specs
)

{:next_state, :configured, new_data, actions}
|> case do
{:ok, _pid} ->
{:next_state, :configured, new_data, actions}

{:error, _reason} ->
debug(
data,
":configuring -> done error starting: retrying after #{config.retry_millis} ms"
)

{new_data, actions} = reply_to_waiters(data)
new_data = %{new_data | command_runner: nil}
actions = [{:state_timeout, config.retry_millis, :retry_timeout} | actions]
update_properties(:retrying, new_data)
{:next_state, :retrying, new_data, actions}
end
end

@impl GenStateMachine
Expand Down
4 changes: 1 addition & 3 deletions lib/vintage_net/interface/supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ defmodule VintageNet.Interface.Supervisor do
start: {Supervisor, :start_link, [child_specs, [strategy: restart_strategy]]}
}

{:ok, _pid} = Supervisor.start_child(via_name(ifname), supervisor_spec)

:ok
Supervisor.start_child(via_name(ifname), supervisor_spec)
end

@doc """
Expand Down

0 comments on commit 41b850a

Please sign in to comment.