Repository: thrift Updated Branches: refs/heads/master a84e13921 -> 145749c7a
THRIFT-3390 Tornado server should gracefully handle closed connections Clidnt: Python.Tornado Patch: Christian Verkerk <[email protected]> This closes #654 Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/145749c7 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/145749c7 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/145749c7 Branch: refs/heads/master Commit: 145749c7a2692a29e2c7fc4088e336e37a2ff7e3 Parents: a84e139 Author: Jens Geyer <[email protected]> Authored: Fri Oct 16 19:21:22 2015 +0200 Committer: Jens Geyer <[email protected]> Committed: Fri Oct 16 19:21:22 2015 +0200 ---------------------------------------------------------------------- lib/py/src/TTornado.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/145749c7/lib/py/src/TTornado.py ---------------------------------------------------------------------- diff --git a/lib/py/src/TTornado.py b/lib/py/src/TTornado.py index ef3e0f2..65795ab 100644 --- a/lib/py/src/TTornado.py +++ b/lib/py/src/TTornado.py @@ -171,7 +171,13 @@ class TTornadoServer(tcpserver.TCPServer): try: while not trans.stream.closed(): - frame = yield trans.readFrame() + try: + frame = yield trans.readFrame() + except TTransportException as e: + if e.type == TTransportException.END_OF_FILE: + break + else: + raise tr = TMemoryBuffer(frame) iprot = self._iprot_factory.getProtocol(tr) yield self._processor.process(iprot, oprot)
