mirror of
https://github.com/threefoldtech/mycelium.git
synced 2026-10-23 14:02:21 +00:00
Kill peer connection if router appears to be gone
If the router is gone (or the receiver of the packet forward channels, at least), peers got stuck repeatedly trying to forward packets to said router. Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
2 files changed
+8
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user