Followup messages modification

This commit is contained in:
Zoltan Papp 2024-05-17 23:41:47 +02:00
parent 6ae7a790f2
commit d4eaec5cbd

View File

@ -109,12 +109,11 @@ func MarshalTransportMsg(channelId uint16, payload []byte) []byte {
return msg return msg
} }
func UnmarshalTransportMsg(buf []byte) (uint16, []byte, error) { func UnmarshalTransportPayload(buf []byte) ([]byte, error) {
if len(buf) < 3 { if len(buf) < 3 {
return 0, nil, ErrInvalidMessageLength return nil, ErrInvalidMessageLength
} }
channelId := uint16(buf[1])<<8 | uint16(buf[2]) return buf[3:], nil
return channelId, buf[3:], nil
} }
func UnmarshalTransportID(buf []byte) (uint16, error) { func UnmarshalTransportID(buf []byte) (uint16, error) {