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 619ea70..444b768 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 @@
self._oprot_factory = oprot_factory
self.recv_map = {}
+ self.started = defer.Deferred()
def dispatch(self, msg):
self.sendString(msg)
@@ -52,6 +54,7 @@
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():