Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not expect set_technology to succeed #420

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ->
{: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
6 changes: 3 additions & 3 deletions lib/vintage_net/interface/supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ 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
with {:ok, _} <- Supervisor.start_child(via_name(ifname), supervisor_spec) do
:ok
end
end

@doc """
Expand Down