Răsfoiți Sursa

channel: actually stop the channel on main_receive_loop() error

Previously we would return Error::ChannelStopped which triggers
handle_error but doesn't actually explicitly stop the channel. This was
leading inbound session to hang forever on `stop_sub.receive().await`.

Also add some useful debug info to inbound_session.rs.
draoi 2 ani în urmă
părinte
comite
1b24bfa340
2 a modificat fișierele cu 5 adăugiri și 1 ștergeri
  1. 3 0
      src/net/channel.rs
  2. 2 1
      src/net/session/inbound_session.rs

+ 3 - 0
src/net/channel.rs

@@ -363,6 +363,8 @@ impl Channel {
                         target: "net::channel::main_receive_loop()",
                         "Stopping channel {:?}", self
                     );
+
+                    self.stop().await;
                     return Err(Error::ChannelStopped)
                 }
             };
@@ -383,6 +385,7 @@ impl Channel {
                         self.ban(self.address()).await;
                     }
 
+                    self.stop().await;
                     return Err(Error::ChannelStopped)
                 }
                 Err(_) => unreachable!("You added a new error in notify()"),

+ 2 - 1
src/net/session/inbound_session.rs

@@ -191,7 +191,8 @@ impl InboundSession {
 
         debug!(
             target: "net::inbound_session::setup_channel()",
-            "Received stop_sub, channel removed from P2P",
+            "Received stop_sub, channel {:?} removed from P2P",
+            channel
         );
 
         dnetev!(self, InboundDisconnected, {