Author: todd
Date: Thu Dec 3 01:18:44 2009
New Revision: 886646
URL: http://svn.apache.org/viewvc?rev=886646&view=rev
Log:
THRIFT-637. python: Fix mixing of oneway and regular requests in
TNonblockingServer
Modified:
incubator/thrift/trunk/lib/py/src/server/TNonblockingServer.py
incubator/thrift/trunk/test/py/TestClient.py
Modified: incubator/thrift/trunk/lib/py/src/server/TNonblockingServer.py
URL:
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/py/src/server/TNonblockingServer.py?rev=886646&r1=886645&r2=886646&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/py/src/server/TNonblockingServer.py (original)
+++ incubator/thrift/trunk/lib/py/src/server/TNonblockingServer.py Thu Dec 3
01:18:44 2009
@@ -178,11 +178,12 @@
self.wake_up()
return
self.len = ''
- self.message = struct.pack('!i', len(message)) + message
if len(message) == 0:
# it was a oneway request, do not write answer
+ self.message = ''
self.status = WAIT_LEN
else:
+ self.message = struct.pack('!i', len(message)) + message
self.status = SEND_ANSWER
self.wake_up()
Modified: incubator/thrift/trunk/test/py/TestClient.py
URL:
http://svn.apache.org/viewvc/incubator/thrift/trunk/test/py/TestClient.py?rev=886646&r1=886645&r2=886646&view=diff
==============================================================================
--- incubator/thrift/trunk/test/py/TestClient.py (original)
+++ incubator/thrift/trunk/test/py/TestClient.py Thu Dec 3 01:18:44 2009
@@ -129,6 +129,10 @@
end = time.time()
self.assertTrue(end - start < 0.2,
"oneway sleep took %f sec" % (end - start))
+
+ def testOnewayThenNormal(self):
+ self.client.testOneway(0.5)
+ self.assertEqual(self.client.testString('Python'), 'Python')
class NormalBinaryTest(AbstractTest):
protocol_factory = TBinaryProtocol.TBinaryProtocolFactory()