Просмотр исходного кода

session: fix bitflags on mod.rs

draoi 2 лет назад
Родитель
Сommit
7e95c56d61
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      src/net/session/mod.rs

+ 4 - 3
src/net/session/mod.rs

@@ -70,7 +70,8 @@ pub async fn remove_sub_on_stop(p2p: P2pPtr, channel: ChannelPtr, type_id: Sessi
         "Received stop event. Removing channel {}", addr,
     );
 
-    if type_id == SESSION_MANUAL || type_id == SESSION_OUTBOUND {
+    // Downgrade to greylist this is a outbound or manual session.
+    if type_id & (SESSION_MANUAL | SESSION_OUTBOUND) != 0 {
         debug!(
             target: "net::session::remove_sub_on_stop()",
             "Downgrading {}", addr,
@@ -164,8 +165,8 @@ pub trait Session: Sync {
         // Perform handshake
         protocol_version.run(executor.clone()).await?;
 
-        // Upgrade to goldlist if outbound or manual session.
-        if self.type_id() == SESSION_MANUAL || self.type_id() == SESSION_OUTBOUND {
+        // Upgrade to goldlist if this is a outbound or manual session.
+        if self.type_id() & (SESSION_MANUAL | SESSION_OUTBOUND) != 0 {
             debug!(
                 target: "net::session::perform_handshake_protocols()",
                 "Upgrading {}", channel.address(),