From fc8333bf8bd49ae1e2af633cfa80f5ad7f2e6f1c Mon Sep 17 00:00:00 2001 From: Cameron Dale Date: Sun, 4 May 2008 14:16:25 -0700 Subject: [PATCH] Fixed a bug in the HTTP downloader that caused errors with some mirrors that always close the connections. --- apt_p2p/HTTPDownloader.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apt_p2p/HTTPDownloader.py b/apt_p2p/HTTPDownloader.py index d1ea0a9..1a0752c 100644 --- a/apt_p2p/HTTPDownloader.py +++ b/apt_p2p/HTTPDownloader.py @@ -358,8 +358,9 @@ class Peer(ClientFactory): def _processLastResponse(self): """Save the download time of the last request for speed calculations.""" if self._lastResponse is not None: - now = datetime.now() - self._downloadSpeeds.append((now, now - self._lastResponse[0], self._lastResponse[1])) + if self._lastResponse[1] is not None: + now = datetime.now() + self._downloadSpeeds.append((now, now - self._lastResponse[0], self._lastResponse[1])) self._lastResponse = None def downloadSpeed(self): -- 2.39.5