diff --git a/CHANGELOG.md b/CHANGELOG.md index eba96dd..ed18c6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Only do the periodic route announcement every 5 minutes instead of every minute. - Mycelium binary is no longer part of the workspace, and no longer contains private network functionality. +- If a packet received from a peer can't be forwarded to the router, terminate the + connection to the peer. ### Fixed diff --git a/mycelium/src/peer.rs b/mycelium/src/peer.rs index 875c8ee..6322e3e 100644 --- a/mycelium/src/peer.rs +++ b/mycelium/src/peer.rs @@ -98,13 +98,19 @@ impl Peer { Some(Ok(packet)) => { match packet { Packet::DataPacket(packet) => { + // An error here means the receiver is dropped/closed, + // this is not recoverable. if let Err(error) = router_data_tx.send(packet).await{ error!("Error sending to to_routing_data: {}", error); + break } } Packet::ControlPacket(packet) => { if let Err(error) = router_control_tx.send((packet, peer.clone())) { + // An error here means the receiver is dropped/closed, + // this is not recoverable. error!("Error sending to to_routing_control: {}", error); + break } }