diff --git a/lib/conn/conn-prot.go b/lib/conn/conn-prot.go index 9f37b35..cb542fd 100644 --- a/lib/conn/conn-prot.go +++ b/lib/conn/conn-prot.go @@ -174,6 +174,10 @@ func getPing(clientConn net.Conn) *errco.MshLog { } switch { + case bytes.HasPrefix(pingData, []byte{9, 1, 0, 0, 0, 0, 0}): + // packet is [9 1 0 0 0 0 0 89 73 114] + // this is normal ping + case bytes.Equal(pingData, []byte{1, 0}): // packet is [1 0] // read the second packet diff --git a/lib/conn/conn-prot_test.go b/lib/conn/conn-prot_test.go index dfdd2cd..47bb3bc 100644 --- a/lib/conn/conn-prot_test.go +++ b/lib/conn/conn-prot_test.go @@ -148,6 +148,14 @@ func Test_getPing(t *testing.T) { tests := []test{ // positive cases + { + "ping", + [][]byte{ + {9, 1, 0, 0, 0, 0, 0, 89, 73, 114}, + }, + 0, + []byte{9, 1, 0, 0, 0, 0, 0, 89, 73, 114}, + }, { "2 bytes + ping", [][]byte{