فهرست منبع

channel: fix incorrect API usage

draoi 2 سال پیش
والد
کامیت
715f6c7a86
1فایلهای تغییر یافته به همراه2 افزوده شده و 8 حذف شده
  1. 2 8
      src/net/channel.rs

+ 2 - 8
src/net/channel.rs

@@ -174,7 +174,7 @@ impl Channel {
              M::NAME, self,
              M::NAME, self,
         );
         );
 
 
-        if self.stopped.load(SeqCst) {
+        if self.is_stopped() {
             return Err(Error::ChannelStopped)
             return Err(Error::ChannelStopped)
         }
         }
 
 
@@ -299,13 +299,7 @@ impl Channel {
                     debug!(target: "net::channel::main_receive_loop()", "Stopping channel {:?}", self);
                     debug!(target: "net::channel::main_receive_loop()", "Stopping channel {:?}", self);
 
 
                     // We will reject further connections from this peer
                     // We will reject further connections from this peer
-                    self.session
-                        .upgrade()
-                        .unwrap()
-                        .p2p()
-                        .hosts()
-                        .mark_rejected(self.address())
-                        .await;
+                    self.p2p().hosts().mark_rejected(self.address()).await;
 
 
                     return Err(Error::ChannelStopped)
                     return Err(Error::ChannelStopped)
                 }
                 }