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 {
|
||||
buffer := make([]byte, 12 + len(data))
|
||||
buffer := make([]byte, 18 + len(data))
|
||||
tape.EncodeI64(buffer[:8], trans)
|
||||
tape.EncodeI16(buffer[8:10], method)
|
||||
length, ok := tape.U16CastSafe(len(data))
|
||||
if !ok { return ErrPayloadTooLarge }
|
||||
tape.EncodeI16(buffer[10:12], length)
|
||||
copy(buffer[12:], data)
|
||||
tape.EncodeI64(buffer[10:18], uint64(len(data)))
|
||||
copy(buffer[18:], data)
|
||||
_, err := writer.Write(buffer)
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user