loose pong check

Signed-off-by: Delweng <delweng@gmail.com>
This commit is contained in:
Delweng 2026-03-03 23:21:13 +08:00
parent b636489898
commit a4d3ebe822

View file

@ -137,10 +137,13 @@ the attempt from a different IP.`)
t.Fatal("expected WHOAREYOU, got", resp) t.Fatal("expected WHOAREYOU, got", resp)
} }
// Catch the PONG on l2. // Catch the PONG on l2. Only check the request ID here because cross-network
// routing may rewrite the source IP, making PONG.ToIP differ from laddr(l2).IP.
switch resp := conn.read(l2).(type) { switch resp := conn.read(l2).(type) {
case *v5wire.Pong: case *v5wire.Pong:
checkPong(t, resp, ping2, l2) if !bytes.Equal(resp.ReqID, ping2.ReqID) {
t.Fatalf("wrong request ID %x in PONG, want %x", resp.ReqID, ping2.ReqID)
}
default: default:
t.Fatal("expected PONG, got", resp) t.Fatal("expected PONG, got", resp)
} }