MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / version_handshake_v0_rejected

Function version_handshake_v0_rejected

nodedb/tests/native_protocol.rs:275–299  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

273/// (proto v0 only) with a `VersionMismatch` error and clean disconnect.
274#[tokio::test]
275async fn version_handshake_v0_rejected() {
276 // PROTO_VERSION_MIN is 1, so a client advertising [0, 0] has no overlap.
277 if PROTO_VERSION_MIN == 0 {
278 // If MIN were ever lowered to 0, v0 clients would be accepted — skip.
279 return;
280 }
281
282 let server = NativeTestServer::start().await;
283
284 let hello = HelloFrame {
285 proto_min: 0,
286 proto_max: 0,
287 capabilities: 0,
288 };
289 let result = do_handshake(server.addr, &hello).await;
290 server.shutdown().await;
291
292 let err_frame = result.expect_err("v0-only client must be rejected");
293 assert_eq!(
294 err_frame.code,
295 HelloErrorCode::VersionMismatch,
296 "error code must be VersionMismatch, got {:?}",
297 err_frame.code
298 );
299}
300
301/// Version handshake: server rejects a client whose range is entirely above
302/// the server maximum (proto v2+) with a `VersionMismatch` error.

Callers

nothing calls this directly

Calls 2

do_handshakeFunction · 0.85
shutdownMethod · 0.45

Tested by

no test coverage detected