lib/protocol: Hello message length is an int16
It used to be an int32, but that's unnecessary and the spec now says int16. Also relaxes the size requirement to that which fits in a signed int16 instead of limiting to 1024 bytes, to allow for future growth. As reported in https://forum.syncthing.net/t/difference-between-documented-and-implemented-protocol/7798 GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3406
This commit is contained in:
@@ -26,9 +26,9 @@ func TestVersion14Hello(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
hdrBuf := make([]byte, 8)
|
||||
hdrBuf := make([]byte, 6)
|
||||
binary.BigEndian.PutUint32(hdrBuf, HelloMessageMagic)
|
||||
binary.BigEndian.PutUint32(hdrBuf[4:], uint32(len(msgBuf)))
|
||||
binary.BigEndian.PutUint16(hdrBuf[4:], uint16(len(msgBuf)))
|
||||
|
||||
outBuf := new(bytes.Buffer)
|
||||
outBuf.Write(hdrBuf)
|
||||
|
||||
Reference in New Issue
Block a user