This is an automated email from the ASF dual-hosted git repository.
dcelasun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push:
new 4c84737 THRIFT-4908: remove reader&writer in Golang's TBinaryProtocol
4c84737 is described below
commit 4c847372eb9af8ec0b21ace31840eaabfdf32660
Author: guozhu cheng <[email protected]>
AuthorDate: Mon Jul 15 19:46:25 2019 +0800
THRIFT-4908: remove reader&writer in Golang's TBinaryProtocol
Client: go
This closes #1831.
---
lib/go/thrift/binary_protocol.go | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/lib/go/thrift/binary_protocol.go b/lib/go/thrift/binary_protocol.go
index 1f90bf4..93ae898 100644
--- a/lib/go/thrift/binary_protocol.go
+++ b/lib/go/thrift/binary_protocol.go
@@ -32,8 +32,6 @@ import (
type TBinaryProtocol struct {
trans TRichTransport
origTransport TTransport
- reader io.Reader
- writer io.Writer
strictRead bool
strictWrite bool
buffer [64]byte
@@ -55,8 +53,6 @@ func NewTBinaryProtocol(t TTransport, strictRead, strictWrite
bool) *TBinaryProt
} else {
p.trans = NewTRichTransport(t)
}
- p.reader = p.trans
- p.writer = p.trans
return p
}
@@ -192,21 +188,21 @@ func (p *TBinaryProtocol) WriteByte(value int8) error {
func (p *TBinaryProtocol) WriteI16(value int16) error {
v := p.buffer[0:2]
binary.BigEndian.PutUint16(v, uint16(value))
- _, e := p.writer.Write(v)
+ _, e := p.trans.Write(v)
return NewTProtocolException(e)
}
func (p *TBinaryProtocol) WriteI32(value int32) error {
v := p.buffer[0:4]
binary.BigEndian.PutUint32(v, uint32(value))
- _, e := p.writer.Write(v)
+ _, e := p.trans.Write(v)
return NewTProtocolException(e)
}
func (p *TBinaryProtocol) WriteI64(value int64) error {
v := p.buffer[0:8]
binary.BigEndian.PutUint64(v, uint64(value))
- _, err := p.writer.Write(v)
+ _, err := p.trans.Write(v)
return NewTProtocolException(err)
}
@@ -228,7 +224,7 @@ func (p *TBinaryProtocol) WriteBinary(value []byte) error {
if e != nil {
return e
}
- _, err := p.writer.Write(value)
+ _, err := p.trans.Write(value)
return NewTProtocolException(err)
}
@@ -468,7 +464,7 @@ func (p *TBinaryProtocol) Transport() TTransport {
}
func (p *TBinaryProtocol) readAll(buf []byte) error {
- _, err := io.ReadFull(p.reader, buf)
+ _, err := io.ReadFull(p.trans, buf)
return NewTProtocolException(err)
}