Package DebTorrent :: Module HTTPCache :: Class CacheConnection
[hide private]
[frames] | no frames]

Class CacheConnection

source code

Download files needed for the HTTP download cache from a single server.

Instance Methods [hide private]
 
__init__(self, handler, server)
Initialize the instance.
source code
boolean
queue(self, path, func)
Queue a download for later starting.
source code
 
_run_queue(self)
Start the next element in the queue downloading.
source code
 
_request(self)
Do the request.
source code
 
request_finished(self)
Process the completed request.
source code
 
auto_close(self)
Close the connection if it has been idle.
source code
 
close(self)
Close the connection.
source code
Instance Variables [hide private]
boolean active
whether there is a download underway
boolean closed
whether ther connection has been closed
HTTPConnection connection
the connection to the HTTP server
HTTPCache handler
the cache manager for the download
dictionary headers
the HTTP headers to send in the request
float last_action
the last time an action occurred
CacheRequest request
the request currently in progress
list of CacheRequest request_queue
the waiting requests
string server
the webserver address and port to connect to
string url
the URL to request from the site
Method Details [hide private]

__init__(self, handler, server)
(Constructor)

source code 
Initialize the instance.
Parameters:
  • handler (HTTPCache) - the cache manager for the download
  • server (string) - the server name to send the requests to

queue(self, path, func)

source code 
Queue a download for later starting.
Parameters:
  • path (list of string) - the server and path to download
  • func (method) - the method to call when the download completes
Returns: boolean
whether the download was successfully queued