node: Don't panic on connection logic error

It seems like the underlying network library has a bug, and transport
handovers don't always happen.
This commit is contained in:
cloudhead 2024-06-25 23:42:08 +02:00
parent 0be7453e76
commit bbb292c8e6
No known key found for this signature in database
3 changed files with 8 additions and 2 deletions

View File

@ -1335,6 +1335,12 @@ where
// In this scenario, it's possible that our peer is persistent, and // In this scenario, it's possible that our peer is persistent, and
// disconnected. We get an inbound connection before we attempt a re-connection, // disconnected. We get an inbound connection before we attempt a re-connection,
// and therefore we treat it as a regular inbound connection. // and therefore we treat it as a regular inbound connection.
//
// It's also possible that a disconnection hasn't gone through yet and our
// peer is still in connected state here, while a new inbound connection from
// that same peer is made. This results in a new connection from a peer that is
// already connected from the perspective of the service. This appears to be
// a bug in the underlying networking library.
let peer = e.get_mut(); let peer = e.get_mut();
debug!( debug!(
target: "service", target: "service",

View File

@ -231,7 +231,7 @@ impl Session {
self.last_active = since; self.last_active = since;
if let State::Connected { .. } = &self.state { if let State::Connected { .. } = &self.state {
panic!("Session::to_connected: session is already in 'connected' state"); log::error!(target: "service", "Session {} is already in 'connected' state, resetting..", self.id);
}; };
self.state = State::Connected { self.state = State::Connected {
since, since,

View File

@ -491,7 +491,7 @@ where
&DisconnectReason::connection(), &DisconnectReason::connection(),
); );
} else { } else {
log::warn!(target: "wire", "Tried to cleanup unknown peer with id={id} (fd={fd})"); log::debug!(target: "wire", "Tried to cleanup unknown peer with id={id} (fd={fd})");
} }
} }
} }