Fix the rest of pdu tests
All checks were successful
Run Tests / Test (push) Successful in 28s
Benchmark BufferPool / RunBenchmarks (push) Successful in 38s

This commit is contained in:
2024-07-24 19:12:05 +02:00
parent ec04fa1fb6
commit 500cb11235
2 changed files with 141 additions and 138 deletions

View File

@@ -3,6 +3,7 @@ package pdu
import (
"bytes"
"encoding/binary"
"fmt"
)
type (
@@ -64,6 +65,9 @@ func (p *PDU_HEADER) Encode(buf *bytes.Buffer) error {
return nil
}
func (p *PDU_HEADER) Decode(buf *bytes.Buffer) error {
if buf == nil {
return fmt.Errorf("cannot decode nil buffer")
}
binary.Read(buf, binary.BigEndian, &p.command_length)
binary.Read(buf, binary.BigEndian, &p.command_id)
binary.Read(buf, binary.BigEndian, &p.command_status)