[apt-proxy-devel] r678 - in trunk: apt_proxy apt_proxy/test debian
Chris Halls
halls at alioth.debian.org
Wed Dec 26 20:40:35 UTC 2007
Author: halls
Date: Wed Dec 26 20:40:35 2007
New Revision: 678
Log:
Fix complete_clientless_downloads so apt-proxy stops downloading when unset (Closes: #343395)
Modified:
trunk/apt_proxy/cache.py
trunk/apt_proxy/clients.py
trunk/apt_proxy/test/test_cache.py
trunk/debian/changelog
Modified: trunk/apt_proxy/cache.py
==============================================================================
--- trunk/apt_proxy/cache.py (original)
+++ trunk/apt_proxy/cache.py Wed Dec 26 20:40:35 2007
@@ -169,12 +169,15 @@
log.debug("Last request removed for %s [%s]" % (self.file_path, self.stateToString()),'CacheEntry')
if self.state == self.STATE_CONNECTING:
- self.backend.stop_download(self, request)
+ if request is not None:
+ self.backend.stop_download(self, request)
if self.fetcher is not None:
self.fetcher.cancel_download()
+ self.state = self.STATE_FAILED
elif (self.state == self.STATE_DOWNLOAD and
not self.factory.config.complete_clientless_downloads ):
- self.backend.stop_download(self, request)
+ if request is not None:
+ self.backend.stop_download(self, request)
if (self.factory.config.complete_clientless_downloads == False
and self.fetcher is not None):
# Cancel download in progress
@@ -182,6 +185,7 @@
" to continue)",
'cacheEntry')
self.fetcher.cancel_download()
+ self.state = self.STATE_FAILED
if self.streamfile is not None:
name = self.streamfile.name
Modified: trunk/apt_proxy/clients.py
==============================================================================
--- trunk/apt_proxy/clients.py (original)
+++ trunk/apt_proxy/clients.py Wed Dec 26 20:40:35 2007
@@ -188,8 +188,9 @@
The connection with the client was lost, remove this request from its
Fetcher.
"""
- log.debug("connectionLost" , 'HttpRequestClient')
+ log.debug("connectionLost (%s)" % self.uri , 'HttpRequestClient')
if self.cacheEntry:
+ log.debug("removing request from cache entry (%s)" % self.uri , 'HttpRequestClient')
reactor.callLater(0, self.cacheEntry.remove_request, self)
self.cacheEntry = None
#self.finish()
Modified: trunk/apt_proxy/test/test_cache.py
==============================================================================
--- trunk/apt_proxy/test/test_cache.py (original)
+++ trunk/apt_proxy/test/test_cache.py Wed Dec 26 20:40:35 2007
@@ -223,6 +223,16 @@
self.assertApproximates(self.entry.file_mtime, close_time, 3)
self.assertEquals(self.entry.file_size, 5)
+ def testRemoveRequestOnAbort(self):
+ # Ensure that requests are correctly set to failed if aborted early
+ self.factory.config.complete_clientless_downloads = False
+ for state in self.entry.STATE_CONNECTING, self.entry.STATE_DOWNLOAD:
+ self.entry.state = state
+ self.entry.remove_request(None)
+ self.assertEquals(self.entry.state, self.entry.STATE_FAILED,
+ "State did not change %s -> New on abort (state is %s)" %
+ (self.entry.stateToString(state), self.entry.stateToString(self.entry.state)))
+
class FileTypeTest(unittest.TestCase):
def testUnknownFiletype(self):
self.assertEquals(findFileType('unknownfile.xxx'), None)
Modified: trunk/debian/changelog
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Wed Dec 26 20:40:35 2007
@@ -2,6 +2,8 @@
* Ensure that the status of a file is always reset, even if the download
does not complete (Closes: #428505)
+ * Fix complete_clientless_downloads so apt-proxy stops downloading when
+ unset (Closes: #343395)
* Add a generic error handler for unknown exceptions when a client requests a
file. This is the start of making apt-proxy fail safely by resetting its
internal state when something strange happens.
@@ -9,7 +11,7 @@
were already closed
* Add more unit tests
- -- Chris Halls <halls at debian.org> Mon, 13 Aug 2007 23:41:10 +0100
+ -- Chris Halls <halls at debian.org> Fri, 31 Aug 2007 18:09:07 +0100
apt-proxy (1.9.36.1) unstable; urgency=low
More information about the apt-proxy-devel
mailing list