diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index bc79531c1..8ba0b5c50 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -106,7 +106,7 @@ }, { "ImportPath": "github.com/jbenet/go-msgio", - "Rev": "634f25d82673bbdb0b87b8d7e1b7a3df59ede671" + "Rev": "7bdc5b738564871e1c0d5ca9449900d0d6773713" }, { "ImportPath": "github.com/jbenet/go-multiaddr", diff --git a/Godeps/_workspace/src/github.com/jbenet/go-msgio/msgio.go b/Godeps/_workspace/src/github.com/jbenet/go-msgio/msgio.go index 3c03243bf..f4a61aff0 100644 --- a/Godeps/_workspace/src/github.com/jbenet/go-msgio/msgio.go +++ b/Godeps/_workspace/src/github.com/jbenet/go-msgio/msgio.go @@ -17,7 +17,7 @@ const lengthSize = 4 type Writer interface { // Write writes passed in buffer as a single message. - Write([]byte) error + Write([]byte) (int, error) // WriteMsg writes the msg in the passed in buffer. WriteMsg([]byte) error @@ -79,8 +79,12 @@ func NewWriter(w io.Writer) WriteCloser { return &writer{W: w, lock: new(sync.Mutex)} } -func (s *writer) Write(msg []byte) (err error) { - return s.WriteMsg(msg) +func (s *writer) Write(msg []byte) (int, error) { + err := s.WriteMsg(msg) + if err != nil { + return 0, err + } + return len(msg), nil } func (s *writer) WriteMsg(msg []byte) (err error) { diff --git a/Godeps/_workspace/src/github.com/jbenet/go-msgio/msgio_test.go b/Godeps/_workspace/src/github.com/jbenet/go-msgio/msgio_test.go index 80733a6b6..cef3e9cd0 100644 --- a/Godeps/_workspace/src/github.com/jbenet/go-msgio/msgio_test.go +++ b/Godeps/_workspace/src/github.com/jbenet/go-msgio/msgio_test.go @@ -20,10 +20,13 @@ func TestReadWrite(t *testing.T) { r := rand.New(rand.NewSource(time.Now().UnixNano())) for i := range msgs { msgs[i] = randbuf.RandBuf(r, r.Intn(1000)) - err := writer.Write(msgs[i]) + n, err := writer.Write(msgs[i]) if err != nil { t.Fatal(err) } + if n != len(msgs[i]) { + t.Fatal("wrong length:", n, len(msgs[i])) + } } if err := writer.Close(); err != nil {