修复handshake发送S0S1S2

This commit is contained in:
dexter
2023-02-18 23:10:41 +08:00
parent 1188afbc3a
commit 93420a312c

View File

@@ -114,10 +114,9 @@ func (nc *NetConnection) simple_handshake(C1 []byte) error {
util.PutBE(S0S1[1:5], time.Now().Unix()&0xFFFFFFFF)
copy(S0S1[5:], "Monibuca")
nc.Write(S0S1)
nc.Write(C1) // S2
if C2 := ReadBuf(nc.Reader, C1S1_SIZE); bytes.Compare(C2[8:], S0S1[9:]) != 0 {
return errors.New("C2 Error")
} else {
nc.Write(C2) //S2
}
return nil
}