Parcourir la source

fix: remove `assert_eq` for `read_hello`

Yujia Qiao il y a 4 ans
Parent
commit
f772c7cfed
1 fichiers modifiés avec 7 ajouts et 3 suppressions
  1. 7 3
      src/protocol.rs

+ 7 - 3
src/protocol.rs

@@ -192,9 +192,13 @@ pub async fn read_hello<T: AsyncRead + AsyncWrite + Unpin>(conn: &mut T) -> Resu
             }
         }
         Hello::DataChannelHello(v, _) => {
-            // This assert should not fail because the version has already been
-            // checked by ControlChannelHello.
-            assert_eq!(v, CURRENT_PROTO_VERSION);
+            if v != CURRENT_PROTO_VERSION {
+                bail!(
+                    "Protocol version mismatched. Expected {}, got {}. Please update `rathole`.",
+                    CURRENT_PROTO_VERSION,
+                    v
+                );
+            }
         }
     }