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 2016/04/01 20:54:06 UTC
thrift git commit: THRIFT-3771 TBufferedTransport gets in invalid
state on read/write errors Client: Go Patch: Tyler Treat
Repository: thrift
Updated Branches:
refs/heads/master fe9222a6e -> cdc83335d
THRIFT-3771 TBufferedTransport gets in invalid state on read/write errors
Client: Go
Patch: Tyler Treat
This closes #973
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/cdc83335
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/cdc83335
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/cdc83335
Branch: refs/heads/master
Commit: cdc83335d60756c4bfb0d2c8af7933500c9e3c06
Parents: fe9222a
Author: Tyler Treat <ty...@webfilings.com>
Authored: Fri Apr 1 13:25:48 2016 -0500
Committer: Jens Geyer <je...@apache.org>
Committed: Fri Apr 1 20:53:37 2016 +0200
----------------------------------------------------------------------
lib/go/thrift/buffered_transport.go | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/cdc83335/lib/go/thrift/buffered_transport.go
----------------------------------------------------------------------
diff --git a/lib/go/thrift/buffered_transport.go b/lib/go/thrift/buffered_transport.go
index 8bcad1e..f73a98b 100644
--- a/lib/go/thrift/buffered_transport.go
+++ b/lib/go/thrift/buffered_transport.go
@@ -62,8 +62,25 @@ func (p *TBufferedTransport) Close() (err error) {
return p.tp.Close()
}
+func (p *TBufferedTransport) Read(b []byte) (int, error) {
+ n, err := p.ReadWriter.Read(b)
+ if err != nil {
+ p.ReadWriter.Reader.Reset(p.tp)
+ }
+ return n, err
+}
+
+func (p *TBufferedTransport) Write(b []byte) (int, error) {
+ n, err := p.ReadWriter.Write(b)
+ if err != nil {
+ p.ReadWriter.Writer.Reset(p.tp)
+ }
+ return n, err
+}
+
func (p *TBufferedTransport) Flush() error {
if err := p.ReadWriter.Flush(); err != nil {
+ p.ReadWriter.Writer.Reset(p.tp)
return err
}
return p.tp.Flush()
@@ -72,4 +89,3 @@ func (p *TBufferedTransport) Flush() error {
func (p *TBufferedTransport) RemainingBytes() (num_bytes uint64) {
return p.tp.RemainingBytes()
}
-