Refactor the decode tests
This commit is contained in:
@@ -47,7 +47,7 @@ func (p *PDU_HEADER) EncodeInto(buf *[]uint8) error {
|
||||
binary.BigEndian.PutUint32(bufVal[12:16], p.sequence_number)
|
||||
return nil
|
||||
}
|
||||
func (p *PDU_HEADER) Decode(data []uint8) {
|
||||
func (p *PDU_HEADER) Decode(data []uint8) error {
|
||||
if len(data) >= 4 {
|
||||
p.command_length = binary.BigEndian.Uint32(data[0:4])
|
||||
}
|
||||
@@ -61,4 +61,5 @@ func (p *PDU_HEADER) Decode(data []uint8) {
|
||||
if len(data) >= 16 {
|
||||
p.sequence_number = binary.BigEndian.Uint32(data[12:16])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user