From 02196654d911f6f5084ac94f107f9eddc26392ef Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Wed, 26 Sep 2018 06:49:39 -0700 Subject: [PATCH] update --- src/comm/comm.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/comm/comm.go b/src/comm/comm.go index b68e7ec..aea7486 100644 --- a/src/comm/comm.go +++ b/src/comm/comm.go @@ -32,9 +32,8 @@ func (c Comm) Close() { c.connection.Close() } - func (c Comm) Write(b []byte) (int, error) { - c.connection.Write([]byte(fmt.Sprintf("%0.5d", len(b)))) + c.connection.Write([]byte(fmt.Sprintf("%0.6d", len(b)))) n, err := c.connection.Write(b) if n != len(b) { err = fmt.Errorf("wanted to write %d but wrote %d", n, len(b)) @@ -44,8 +43,8 @@ func (c Comm) Write(b []byte) (int, error) { } func (c Comm) Read() (buf []byte, numBytes int, bs []byte, err error) { - // read until we get 5 bytes - tmp := make([]byte, 5) + // read until we get 6 bytes + tmp := make([]byte, 6) n, err := c.connection.Read(tmp) if err != nil { return @@ -59,7 +58,7 @@ func (c Comm) Read() (buf []byte, numBytes int, bs []byte, err error) { for { // see if we have enough bytes bs = bytes.Trim(bs, "\x00") - if len(bs) == 5 { + if len(bs) == 6 { break } n, err := c.connection.Read(tmp)