mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
fix(connlib): exit phoenix-channel event-loop on error (#10229)
We cannot poll the `PhoenixChannel` after it has returned an error, otherwise it will panic. Therefore, we exit the event-loop then. The outer event-loop also exits as soon as it receives an error from this channel so this is fine. `PhoenixChannel` only returns an error when it has irrecoverably disconnected, e.g. after the retries have been exhausted or we hit a 4xx error on the WebSocket connection. --------- Signed-off-by: Thomas Eizinger <thomas@eizinger.io> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -479,10 +479,9 @@ async fn phoenix_channel_event_loop(
|
||||
"Hiccup in portal connection: {error:#}"
|
||||
),
|
||||
Either::Left((Err(e), _)) => {
|
||||
if event_tx.send(PortalEvent::Error(e)).await.is_err() {
|
||||
tracing::debug!("Event channel closed: exiting phoenix-channel event-loop");
|
||||
break;
|
||||
}
|
||||
let _ = event_tx.send(PortalEvent::Error(e)).await; // We don't care about the result because we are exiting anyway.
|
||||
|
||||
break;
|
||||
}
|
||||
Either::Right((Some(PortalCommand::Send(msg)), _)) => {
|
||||
portal.send(PHOENIX_TOPIC, msg);
|
||||
|
||||
@@ -632,10 +632,9 @@ async fn phoenix_channel_event_loop(
|
||||
"Hiccup in portal connection: {error:#}"
|
||||
),
|
||||
Either::Left((Err(e), _)) => {
|
||||
if event_tx.send(Err(e)).await.is_err() {
|
||||
tracing::debug!("Event channel closed: exiting phoenix-channel event-loop");
|
||||
break;
|
||||
}
|
||||
let _ = event_tx.send(Err(e)).await; // We don't care about the result because we are exiting anyway.
|
||||
|
||||
break;
|
||||
}
|
||||
Either::Right((Some(PortalCommand::Send(msg)), _)) => {
|
||||
portal.send(PHOENIX_TOPIC, msg);
|
||||
|
||||
Reference in New Issue
Block a user