From 1f9c435901ef0c51ac1f983e0d8d74c86af7de44 Mon Sep 17 00:00:00 2001 From: Jakub Matys Date: Wed, 24 Sep 2014 14:55:43 +0200 Subject: [PATCH] Will errback a failure when connection is lost --- lib/python/txmsgpack/protocol.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/python/txmsgpack/protocol.py b/lib/python/txmsgpack/protocol.py index 02187ea..09b1c3d 100644 --- a/lib/python/txmsgpack/protocol.py +++ b/lib/python/txmsgpack/protocol.py @@ -271,7 +271,7 @@ def undefinedMessageReceived(self, message): def connectionMade(self): #print "connectionMade" - self.factory.numProtocols = self.factory.numProtocols+1 + self.factory.numProtocols = self.factory.numProtocols+1 """ self.transport.write( "Welcome! There are currently %d open connections.\n" % @@ -280,6 +280,11 @@ def connectionMade(self): def connectionLost(self, reason): #print "connectionLost" + + while(len(self._outgoing_requests) > 0): + msgid, df = self._outgoing_requests.popitem() + df.errback(reason) + self.factory.numProtocols = self.factory.numProtocols-1 def closeConnection(self):