From: Kevin Clark Date: Tue, 3 Mar 2009 22:13:46 +0000 (+0000) Subject: THRIFT-148. py: One more time, reapply the most *recent* patch X-Git-Tag: 0.2.0~280 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=e8d3c47944139364d0573fa82c3d5ba877df13e9;p=common%2Fthrift.git THRIFT-148. py: One more time, reapply the most *recent* patch git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@749795 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/py/src/transport/TTwisted.py b/lib/py/src/transport/TTwisted.py index 619ea700..444b7682 100644 --- a/lib/py/src/transport/TTwisted.py +++ b/lib/py/src/transport/TTwisted.py @@ -1,6 +1,7 @@ from zope.interface import implements, Interface, Attribute -from twisted.internet.protocol import Protocol, ServerFactory, ClientFactory, +from twisted.internet.protocol import Protocol, ServerFactory, ClientFactory, \ connectionDone +from twisted.internet import defer from twisted.protocols import basic from twisted.python import log from thrift.transport import TTransport @@ -45,6 +46,7 @@ class ThriftClientProtocol(basic.Int32StringReceiver): self._oprot_factory = oprot_factory self.recv_map = {} + self.started = defer.Deferred() def dispatch(self, msg): self.sendString(msg) @@ -52,6 +54,7 @@ class ThriftClientProtocol(basic.Int32StringReceiver): def connectionMade(self): tmo = TCallbackTransport(self.dispatch) self.client = self._client_class(tmo, self._oprot_factory) + self.started.callback(self.client) def connectionLost(self, reason=connectionDone): for k,v in self.client._reqs.iteritems():