summaryrefslogtreecommitdiff
path: root/src/leap/common
diff options
context:
space:
mode:
authorBruno Wagner <bwgpro@gmail.com>2015-08-04 18:44:21 -0300
committerBruno Wagner <bwgpro@gmail.com>2015-08-04 18:44:21 -0300
commit0a8f455965fff778d993912f1dc11a77db264a93 (patch)
treed9ecefed2a81476227c61353b7c19bfd8458198f /src/leap/common
parente3dfc2b6627f9db6a0ee50ee7d75d433a3816c3f (diff)
[bug] HTTP timeout was not being cleared on abort
In case the http client loses connection, it has to clear it's timeout or the reactor will be left in a dirty state Fixing this solves a problem with some of the tests in Soledad that were trying to run on a dirty reactor
Diffstat (limited to 'src/leap/common')
-rw-r--r--src/leap/common/http.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/leap/common/http.py b/src/leap/common/http.py
index 1e7ded7..cda8ee8 100644
--- a/src/leap/common/http.py
+++ b/src/leap/common/http.py
@@ -302,23 +302,16 @@ class _HTTP11ClientProtocol(HTTP11ClientProtocol):
"""
Cancel the request timeout, when it's finished.
"""
- if self._timeoutCall.active():
+ if self._timeoutCall and self._timeoutCall.active():
self._timeoutCall.cancel()
self._timeoutCall = None
- def _finishResponse_WAITING(self, rest):
- """
- Cancel the timeout when finished receiving the response.
- """
- self._cancelTimeout()
- HTTP11ClientProtocol._finishResponse_WAITING(self, rest)
-
- def _finishResponse_TRANSMITTING(self, rest):
+ def _finishResponse(self, rest):
"""
Cancel the timeout when finished receiving the response.
"""
self._cancelTimeout()
- HTTP11ClientProtocol._finishResponse_TRANSMITTING(self, rest)
+ HTTP11ClientProtocol._finishResponse(self, rest)
def dataReceived(self, bytes):
"""
@@ -330,3 +323,7 @@ class _HTTP11ClientProtocol(HTTP11ClientProtocol):
HTTP11ClientProtocol.dataReceived(self, bytes)
if self._timeoutCall and self._timeoutCall.active():
self._timeoutCall.reset(self._timeout)
+
+ def connectionLost(self, reason):
+ self._cancelTimeout()
+ return HTTP11ClientProtocol.connectionLost(self, reason)