good morning!!!!

Skip to content
Snippets Groups Projects
Commit 566665d7 authored by Garet Halliday's avatar Garet Halliday
Browse files

very cool

parent bd58be4a
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,6 @@ package zap
import (
"encoding/binary"
"io"
"log"
"math"
"pggat2/lib/util/decorator"
......@@ -57,14 +56,12 @@ func (T *Buf) Read(reader io.Reader, typed bool) (In, error) {
length := binary.BigEndian.Uint32(T.buf[1:])
// read payload
T.buf = slices.Resize(T.buf, int(length)+5)
T.buf = slices.Resize(T.buf, int(length)+1)
_, err = io.ReadFull(reader, T.buf[5:])
if err != nil {
return In{}, err
}
log.Printf("read packet %c %v\n", T.readType(), T.remaining())
return In{
buf: T,
rev: T.rev,
......@@ -99,11 +96,9 @@ func (T *Buf) full() []byte {
binary.BigEndian.PutUint32(T.buf[1:], uint32(len(T.buf)-1))
if T.readType() == 0 {
log.Println("write untyped packet", T.buf[5:])
// untyped
return T.buf[1:]
} else {
log.Printf("write typed packet %c %v\n", T.buf[0], T.buf[5:])
// typed
return T.buf
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment