From fc9f227ccf6708f3daf7c49bf62c044bbb95124f Mon Sep 17 00:00:00 2001 From: Qian Wang Date: Thu, 8 Aug 2019 10:56:29 +0100 Subject: [PATCH] stream.Write now returns the correct amount of data written --- internal/multiplex/stream.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/multiplex/stream.go b/internal/multiplex/stream.go index 74313e9..2beb08e 100644 --- a/internal/multiplex/stream.go +++ b/internal/multiplex/stream.go @@ -81,7 +81,6 @@ func (s *Stream) Read(buf []byte) (n int, err error) { //log.Tracef("%v read from stream %v with err %v",n, s.id,err) return } - } func (s *Stream) Write(in []byte) (n int, err error) { @@ -110,7 +109,10 @@ func (s *Stream) Write(in []byte) (n int, err error) { } n, err = s.session.sb.send(s.obfsBuf[:i], &s.assignedConnId) //log.Tracef("%v sent to remote through stream %v with err %v",n, s.id,err) - return + if err != nil { + return + } + return len(in), nil }