THRIFT-2280 TJSONProtocol.Flush() does not really flush the transport
authorJens Geyer <jensg@apache.org>
Fri, 6 Dec 2013 23:08:37 +0000 (00:08 +0100)
committerJens Geyer <jensg@apache.org>
Fri, 6 Dec 2013 23:11:34 +0000 (00:11 +0100)
Patch: Jens Geyer

lib/go/thrift/json_protocol.go

index 957d8ed..5a432c3 100644 (file)
@@ -442,7 +442,11 @@ func (p *TJSONProtocol) ReadBinary() ([]byte, error) {
 }
 
 func (p *TJSONProtocol) Flush() (err error) {
-       return NewTProtocolException(p.writer.Flush())
+       err = p.writer.Flush()
+       if err == nil {
+               err = p.trans.Flush()
+       }
+       return NewTProtocolException(err)
 }
 
 func (p *TJSONProtocol) Skip(fieldType TType) (err error) {