fix reconnecting with same peer ID

pull/19/head
Niko PLP 7 months ago
parent 993aa5622c
commit 46c15a4a2b
  1. 2
      ng-net/src/broker.rs
  2. 11
      ng-net/src/connection.rs

@ -767,7 +767,7 @@ impl Broker {
match already.unwrap().connected { match already.unwrap().connected {
PeerConnection::NONE => {} PeerConnection::NONE => {}
PeerConnection::Client(mut cnx) => { PeerConnection::Client(mut cnx) => {
cnx.close().await; cnx.close_silently().await;
} }
_ => {} _ => {}
}; };

@ -1319,6 +1319,17 @@ impl ConnectionBase {
self.send(ConnectionCommand::Close).await; self.send(ConnectionCommand::Close).await;
} }
pub async fn close_silently(&mut self) {
log_debug!("closing silently...");
let _ = self
.shutdown_sender
.take()
.unwrap()
.send(Either::Left(NetError::Closing))
.await;
self.send(ConnectionCommand::Close).await;
}
pub async fn admin< pub async fn admin<
A: Into<ProtocolMessage> A: Into<ProtocolMessage>
+ Into<AdminRequestContentV0> + Into<AdminRequestContentV0>

Loading…
Cancel
Save