small fix

This commit is contained in:
Zack Scholl 2019-05-01 12:08:24 -06:00
parent 48819a9e03
commit 9f6936e1ff
1 changed files with 2 additions and 1 deletions

View File

@ -69,7 +69,7 @@ func (c *Comm) Read() (buf []byte, numBytes int, bs []byte, err error) {
var header []byte var header []byte
numBytes = 4 numBytes = 4
for { for {
tmp := make([]byte,numBytes-len(header)) tmp := make([]byte, numBytes-len(header))
n, errRead := c.connection.Read(tmp) n, errRead := c.connection.Read(tmp)
if errRead != nil { if errRead != nil {
err = errRead err = errRead
@ -88,6 +88,7 @@ func (c *Comm) Read() (buf []byte, numBytes int, bs []byte, err error) {
fmt.Println("binary.Read failed:", err) fmt.Println("binary.Read failed:", err)
} }
numBytes = int(numBytesUint32) numBytes = int(numBytesUint32)
buf = make([]byte, 0)
for { for {
// log.Debugf("bytes: %d/%d",len(buf),numBytes) // log.Debugf("bytes: %d/%d",len(buf),numBytes)
tmp := make([]byte, numBytes-len(buf)) tmp := make([]byte, numBytes-len(buf))