Encode METADAPT-A MMBs properly lmao
This commit is contained in:
parent
fac0c4e31d
commit
46c6361602
@ -268,13 +268,11 @@ type incomingMessage struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func encodeMessageA(writer io.Writer, trans int64, method uint16, data []byte) error {
|
func encodeMessageA(writer io.Writer, trans int64, method uint16, data []byte) error {
|
||||||
buffer := make([]byte, 12 + len(data))
|
buffer := make([]byte, 18 + len(data))
|
||||||
tape.EncodeI64(buffer[:8], trans)
|
tape.EncodeI64(buffer[:8], trans)
|
||||||
tape.EncodeI16(buffer[8:10], method)
|
tape.EncodeI16(buffer[8:10], method)
|
||||||
length, ok := tape.U16CastSafe(len(data))
|
tape.EncodeI64(buffer[10:18], uint64(len(data)))
|
||||||
if !ok { return ErrPayloadTooLarge }
|
copy(buffer[18:], data)
|
||||||
tape.EncodeI16(buffer[10:12], length)
|
|
||||||
copy(buffer[12:], data)
|
|
||||||
_, err := writer.Write(buffer)
|
_, err := writer.Write(buffer)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user