thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tyler Treat <ttrea...@gmail.com>
Subject Reusing TProtocol after write error
Date Thu, 10 Mar 2016 17:26:10 GMT
I have a case where I would like to reuse a TProtocol instance after a
write/flush error occurs on the protocol.

For example, imagine I have a transport which has a size limit on message
frames, and it returns an error if you exceed that limit. The error is
bubbled up to the user, who is then responsible for making a smaller
request. The problem is that some TProtocols have state associated with
them (e.g. in Go, TJSONProtocol has a write buffer and a parse context), so
after an error they are in an invalid state and subsequent uses of them
produce corrupted data. TBinaryProtocol doesn't seem to have this issue.

My question is: would it be reasonable to expose a method for "resetting" a
TProtocol back to its original state such that it can be safely reused
after a failed write or flush?

Thanks,

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message