THRIFT-3390 Tornado server should gracefully handle closed connections

Clidnt: Python.Tornado
Patch: Christian Verkerk <christian@tubularlabs.com>

This closes #654
This commit is contained in:
Jens Geyer 2015-10-16 19:21:22 +02:00
parent a84e139215
commit 145749c7a2

View File

@ -171,7 +171,13 @@ class TTornadoServer(tcpserver.TCPServer):
try:
while not trans.stream.closed():
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)