Skip to content

Commit

Permalink
fix(ethexe): Shutdown network service on channel disconnect (#4104)
Browse files Browse the repository at this point in the history
  • Loading branch information
ark0f authored Aug 2, 2024
1 parent 25cfe80 commit b217495
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions ethexe/network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,15 @@ impl NetworkEventLoop {
loop {
select! {
event = self.swarm.select_next_some() => self.handle_swarm_event(event),
event = self.general_rx.recv() => self.handle_general_rx_event(event),
event = self.general_rx.recv() => match event {
Some(event) => {
self.handle_network_rx_event(event);
}
None => {
log::info!("Network channel has been disconnected, shutting down network service...");
break;
},
},
}
}
}
Expand Down Expand Up @@ -319,12 +327,9 @@ impl NetworkEventLoop {
}
}

fn handle_general_rx_event(&mut self, event: Option<NetworkSenderEvent>) {
fn handle_network_rx_event(&mut self, event: NetworkSenderEvent) {
match event {
None => {
log::trace!("network channel has been disconnected");
}
Some(NetworkSenderEvent::PublishCommitments { data }) => {
NetworkSenderEvent::PublishCommitments { data } => {
if let Err(e) = self
.swarm
.behaviour_mut()
Expand Down

0 comments on commit b217495

Please sign in to comment.