You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2017/07/05 20:17:27 UTC

thrift git commit: THRIFT-4245 Golang TFramedTransport's writeBuffer increases if writes to transport failed Client: Go Patch: liduo04

Repository: thrift
Updated Branches:
  refs/heads/master 5b4c6bfc6 -> 49e510392


THRIFT-4245 Golang TFramedTransport's writeBuffer increases if writes to transport failed
Client: Go
Patch: liduo04 <pi...@qq.com>

This closes #1303


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/49e51039
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/49e51039
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/49e51039

Branch: refs/heads/master
Commit: 49e5103920e75a149d02c7d487496c8c79154a6c
Parents: 5b4c6bf
Author: liduo04 <pi...@qq.com>
Authored: Wed Jul 5 22:01:44 2017 +0800
Committer: Jens Geyer <je...@apache.org>
Committed: Wed Jul 5 21:59:07 2017 +0200

----------------------------------------------------------------------
 lib/go/thrift/framed_transport.go | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/49e51039/lib/go/thrift/framed_transport.go
----------------------------------------------------------------------
diff --git a/lib/go/thrift/framed_transport.go b/lib/go/thrift/framed_transport.go
index 4ae1425..60b1249 100644
--- a/lib/go/thrift/framed_transport.go
+++ b/lib/go/thrift/framed_transport.go
@@ -141,11 +141,13 @@ func (p *TFramedTransport) Flush() error {
 	binary.BigEndian.PutUint32(buf, uint32(size))
 	_, err := p.transport.Write(buf)
 	if err != nil {
+		p.buf.Truncate(0)
 		return NewTTransportExceptionFromError(err)
 	}
 	if size > 0 {
 		if n, err := p.buf.WriteTo(p.transport); err != nil {
 			print("Error while flushing write buffer of size ", size, " to transport, only wrote ", n, " bytes: ", err.Error(), "\n")
+			p.buf.Truncate(0)
 			return NewTTransportExceptionFromError(err)
 		}
 	}