[apt-proxy-devel] r667 - trunk/apt_proxy

Chris Halls halls at alioth.debian.org
Fri Jul 13 11:19:18 UTC 2007


Author: halls
Date: Fri Jul 13 11:19:18 2007
New Revision: 667

Log:
Save socket number so that we can still reference it in download queues even after the connection is closed


Modified:
   trunk/apt_proxy/clients.py

Modified: trunk/apt_proxy/clients.py
==============================================================================
--- trunk/apt_proxy/clients.py	(original)
+++ trunk/apt_proxy/clients.py	Fri Jul 13 11:19:18 2007
@@ -48,12 +48,18 @@
         log.debug("New Request, queued=%s" % (queued),'HttpRequestClient');
         self.factory=channel.factory
         http.Request.__init__(self, channel, queued)
+        self.fileno = -1
 
     def process(self):
         """
         Each new request begins processing here
         """
         log.debug("Processing request for: %s" % (self.uri), 'HttpRequestClient')
+        try:
+            self.fileno = self.channel.transport.fileno()
+        except:
+            log.msg("could not get transport's file descriptor", 'HttpRequestClient')
+
         self.uri = self.clean_path(self.uri)
 
         match = re.search('[^][a-zA-Z0-9~,.+%:;@#?{}()$/_-]', self.uri)
@@ -192,12 +198,7 @@
         """
         Get identifier which is unique per apt client
         """
-        try:
-            fileno = self.channel.transport.fileno()
-        except:
-            fileno = -1
-            log.msg("could not get transport's file descriptor", 'HttpRequestClient')
-        return fileno
+        return self.fileno
 
 class UncompressClient:
     """



More information about the apt-proxy-devel mailing list