r191 - in /debtorrent/trunk: ./ DebTorrent/ DebTorrent/BT1/
camrdale-guest at users.alioth.debian.org
camrdale-guest at users.alioth.debian.org
Mon Jul 30 02:26:41 UTC 2007
Author: camrdale-guest
Date: Mon Jul 30 02:26:41 2007
New Revision: 191
URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=191
Log:
Documentation is complete!
Modified:
debtorrent/trunk/DebTorrent/BT1/AptListener.py
debtorrent/trunk/DebTorrent/BT1/Connecter.py
debtorrent/trunk/DebTorrent/BT1/Downloader.py
debtorrent/trunk/DebTorrent/BT1/DownloaderFeedback.py
debtorrent/trunk/DebTorrent/BT1/HTTPDownloader.py
debtorrent/trunk/DebTorrent/BT1/Statistics.py
debtorrent/trunk/DebTorrent/BT1/Storage.py
debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py
debtorrent/trunk/DebTorrent/BT1/makemetafile.py
debtorrent/trunk/DebTorrent/BT1/track.py
debtorrent/trunk/DebTorrent/BTcrypto.py
debtorrent/trunk/DebTorrent/ConfigDir.py
debtorrent/trunk/DebTorrent/HTTPHandler.py
debtorrent/trunk/DebTorrent/RateLimiter.py
debtorrent/trunk/DebTorrent/RawServer.py
debtorrent/trunk/DebTorrent/ServerPortHandler.py
debtorrent/trunk/DebTorrent/download_bt1.py
debtorrent/trunk/DebTorrent/launchmanycore.py
debtorrent/trunk/DebTorrent/selectpoll.py
debtorrent/trunk/test.py
Modified: debtorrent/trunk/DebTorrent/BT1/AptListener.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/AptListener.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/AptListener.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/AptListener.py Mon Jul 30 02:26:41 2007
@@ -54,7 +54,7 @@
class AptListener:
"""Listen for Apt requests to download files.
- @type handler: unknown
+ @type handler: L{DebTorrent.launchmanycore.LaunchMany}
@ivar handler: the download handler to use
@type config: C{dictionary}
@ivar config: the configuration parameters
@@ -65,26 +65,22 @@
@ivar favicon: file containing x-icon data
@type rawserver: L{DebTorrent.RawServer}
@ivar rawserver: the server to use for scheduling
- @type times: unknown
- @ivar times: unknown
@type state: C{dictionary}
@ivar state: the current state information for the tracking
- @type allowed_IPs: unknown
- @ivar allowed_IPs: unknown
- @type banned_IPs: unknown
- @ivar banned_IPs: unknown
- @type allowed_ip_mtime: unknown
- @ivar allowed_ip_mtime: unknown
- @type banned_ip_mtime: unknown
- @ivar banned_ip_mtime: unknown
- @type prevtime: unknown
- @ivar prevtime: unknown
- @type allow_get: unknown
- @ivar allow_get: unknown
- @type uq_broken: unknown
- @ivar uq_broken: unknown
- @type Filter: unknown
- @ivar Filter: unknown
+ @type allowed_IPs: L{DebTorrent.subnetparse.IP_List}
+ @ivar allowed_IPs: the IPs that are allowed to connect, or None if all are
+ @type banned_IPs: L{DebTorrent.iprangeparse.IP_List}
+ @ivar banned_IPs: the IPs that are not allowed to connect
+ @type allowed_ip_mtime: C{int}
+ @ivar allowed_ip_mtime: the last modification time of the allowed IPs file
+ @type banned_ip_mtime: C{int}
+ @ivar banned_ip_mtime: the last modification time of the banned IPs file
+ @type allow_get: C{boolean}
+ @ivar allow_get: whether downloading of torrent files is allowed
+ @type uq_broken: C{boolean}
+ @ivar uq_broken: whether URL quoting of '+' is broken
+ @type Filter: L{Filter.Filter}
+ @ivar Filter: not used
@type Cache: L{DebTorrent.HTTPCache.HTTPCache}
@ivar Cache: the cache of downloaded files
@type cache_waiting: C{dictionary}
@@ -104,7 +100,7 @@
def __init__(self, handler, config, rawserver):
"""Initialize the instance.
- @type handler: unknown
+ @type handler: L{DebTorrent.launchmanycore.LaunchMany}
@param handler: the download handler to use
@type config: C{dictionary}
@param config: the configuration parameters
@@ -126,7 +122,6 @@
except:
logging.warning('specified favicon file does not exist.')
self.rawserver = rawserver
- self.times = {}
self.state = {}
self.allowed_IPs = None
@@ -135,8 +130,6 @@
self.allowed_ip_mtime = 0
self.banned_ip_mtime = 0
self.read_ip_lists()
-
- self.prevtime = clock()
self.allow_get = config['allow_get']
Modified: debtorrent/trunk/DebTorrent/BT1/Connecter.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Connecter.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Connecter.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Connecter.py Mon Jul 30 02:26:41 2007
@@ -77,7 +77,7 @@
class Connection:
"""A connection to an individual peer.
- @type connection: unknown
+ @type connection: L{DebTorrent.SocketHandler.SingleSocket}
@ivar connection: the connection
@type connecter: L{Connecter}
@ivar connecter: the collection of all connections
@@ -85,7 +85,7 @@
@ivar ccount: the number of the connection
@type got_anything: C{boolean}
@ivar got_anything: whether a message has ever been received on the connection
- @type next_upload: unknown
+ @type next_upload: L{DebTorrent.SocketHandler.SingleSocket}
@ivar next_upload: the connection that will next be allowed to upload
@type outqueue: C{list}
@ivar outqueue: the queue of messages to send on the connection that are
@@ -106,7 +106,7 @@
def __init__(self, connection, connecter, ccount):
"""Initialize the class.
- @type connection: unknown
+ @type connection: L{DebTorrent.SocketHandler.SingleSocket}
@param connection: the connection
@type connecter: L{Connecter}
@param connecter: the collection of all connections
@@ -131,7 +131,8 @@
"""Get the IP address of the connection.
@type real: C{boolean}
- @param real: unknown (optional, defaults to False)
+ @param real: whether to check that the IP is the real one
+ (optional, defaults to False)
"""
@@ -403,10 +404,10 @@
@ivar config: the configration information
@type ratelimiter: L{RateLimiter.RateLimiter}
@ivar ratelimiter: the RateLimiter instance to use
- @type rate_capped: unknown
- @ivar rate_capped: unknown
- @type sched: unknown
- @ivar sched: unknown
+ @type rate_capped: C{boolean}
+ @ivar rate_capped: not used
+ @type sched: C{method}
+ @ivar sched: the method to call to schedule future actions (not used)
@type totalup: L{Debtorrent.CurrentRateMeasure.Measure}
@ivar totalup: the Measure instance to use
@type connections: C{dictionary}
@@ -469,7 +470,7 @@
def connection_made(self, connection):
"""Make a new connection.
- @type connection: unknown
+ @type connection: L{DebTorrent.SocketHandler.SingleSocket}
@param connection: the new connection to make
@rtype: L{Connection}
@return: the new connection
@@ -488,7 +489,7 @@
def connection_lost(self, connection):
"""Process a lost connection.
- @type connection: unknown
+ @type connection: L{DebTorrent.SocketHandler.SingleSocket}
@param connection: the connection that was lost
"""
@@ -503,7 +504,7 @@
def connection_flushed(self, connection):
"""Process a flushed connection.
- @type connection: unknown
+ @type connection: L{DebTorrent.SocketHandler.SingleSocket}
@param connection: the connection that was flushed
"""
@@ -527,7 +528,7 @@
def got_message(self, connection, message):
"""Process a received message on a connection.
- @type connection: unknown
+ @type connection: L{DebTorrent.SocketHandler.SingleSocket}
@param connection: the connection that the message was received on
@type message: C{string}
@param message: the message that was received
Modified: debtorrent/trunk/DebTorrent/BT1/Downloader.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Downloader.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Downloader.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Downloader.py Mon Jul 30 02:26:41 2007
@@ -43,7 +43,7 @@
def __init__(self, ip):
"""Initialize the statistics.
- @type ip: unknown
+ @type ip: C{string}
@param ip: the IP address of the peer (not used)
"""
@@ -127,14 +127,15 @@
@type downloader: L{Downloader}
@ivar downloader: the Downloader instance
- @type connection: unknown
+ @type connection: L{Connecter.Connection}
@ivar connection: the connection to the peer
@type choked: C{boolean}
@ivar choked: whether the peer is choking the download
@type interested: C{boolean}
@ivar interested: whether the peer is interesting
- @type active_requests: C{list}
- @ivar active_requests: unknown
+ @type active_requests: C{list} of (C{int}, C{int}, C{int})
+ @ivar active_requests: the requests that have been sent, the piece, offset
+ within the piece, and the length of the request
@type measure: L{DebTorrent.CurrentRateMeasure.Measure}
@ivar measure: for measuring the download rate from the peer
@type peermeasure: L{DebTorrent.CurrentRateMeasure.Measure}
@@ -161,7 +162,7 @@
@type downloader: L{Downloader}
@param downloader: the parent Downloader instance
- @type connection: unknown
+ @type connection: L{Connecter.Connection}
@param connection: the connection to the peer
"""
@@ -568,32 +569,35 @@
@type banfunc: C{method}
@ivar banfunc: method to call to ban a peer
@type disconnectedseeds: C{dictionary}
- @ivar disconnectedseeds: unknown
+ @ivar disconnectedseeds: seeds that have recently been seen, keys are the
+ seed's peer ID, values are the last time the seed was seen
@type downloads: C{list} of C{SingleDownload}
- @ivar downloads: unknown
+ @ivar downloads: the active downloads from peers
@type perip: C{dictionary}
- @ivar perip: unknown
+ @ivar perip: keys are the IP addresses of peers, values are their L{PerIPStats}
@type gotbaddata: C{dictionary}
- @ivar gotbaddata: unknown
+ @ivar gotbaddata: keys are the IP addresses that have sent bad data
@type kicked: C{dictionary}
- @ivar kicked: unknown
+ @ivar kicked: keys are the IP address, values are the peer ID for peers
+ that have been kicked
@type banned: C{dictionary}
- @ivar banned: unknown
+ @ivar banned: keys are the IP addresses of peers that have been banned,
+ values are their peer IDs
@type kickbans_ok: C{boolean}
@ivar kickbans_ok: whether to automatically kick/ban peers that send
bad data
@type kickbans_halted: C{boolean}
- @ivar kickbans_halted: unknown
+ @ivar kickbans_halted: not used
@type super_seeding: C{boolean}
- @ivar super_seeding: unknown
+ @ivar super_seeding: whether we are in super-seed mode
@type endgamemode: C{boolean}
- @ivar endgamemode: unknown
- @type endgame_queued_pieces: C{list}
- @ivar endgame_queued_pieces: unknown
- @type all_requests: C{list}
- @ivar all_requests: unknown
+ @ivar endgamemode: whether the download is in end-game mode
+ @type endgame_queued_pieces: C{list} of C{int}
+ @ivar endgame_queued_pieces: the list of pieces that are queued in end-game mode
+ @type all_requests: C{list} of (C{int}, C{int}, C{int})
+ @ivar all_requests: all outstanding requests to all peers
@type discarded: C{long}
- @ivar discarded: unknown
+ @ivar discarded: the amount of downloaded data that has been discarded
@type download_rate: C{float}
@ivar download_rate: the maximum rate to download at
@type bytes_requested: C{int}
@@ -601,11 +605,11 @@
@type last_time: C{float}
@ivar last_time: the last time the queue limit was calculated
@type queued_out: C{dictionary}
- @ivar queued_out: unknown
+ @ivar queued_out: keys are L{SingleDownload} that are queued waiting for download
@type requeueing: C{boolean}
- @ivar requeueing: unknown
+ @ivar requeueing: whether requeueing is currently underway
@type paused: C{boolean}
- @ivar paused: unknown
+ @ivar paused: whether the download is paused
"""
@@ -723,7 +727,7 @@
def make_download(self, connection):
"""Create a new L{SingleDownload} instance for a new connection.
- @type connection: unknown
+ @type connection: L{Connecter.Connection}
@param connection: the connection that was received
@rtype: L{SingleDownload}
@return: the newly created SingleDownload instance
Modified: debtorrent/trunk/DebTorrent/BT1/DownloaderFeedback.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/DownloaderFeedback.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/DownloaderFeedback.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/DownloaderFeedback.py Mon Jul 30 02:26:41 2007
@@ -189,7 +189,7 @@
def gather(self, displayfunc = None):
"""Gather the information about the download.
- @type displayfunc: unknown
+ @type displayfunc: C{method}
@param displayfunc: not used (optional)
@rtype: C{dictionary}
@return: various information about the download
Modified: debtorrent/trunk/DebTorrent/BT1/HTTPDownloader.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/HTTPDownloader.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/HTTPDownloader.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/HTTPDownloader.py Mon Jul 30 02:26:41 2007
@@ -75,7 +75,7 @@
@type request_size: C{int}
@ivar request_size: the total size of all requests
@type endflag: C{boolean}
- @ivar endflag: unknown
+ @ivar endflag: whether the download might be in end-game mode
@type error: C{string}
@ivar error: the error received from the server
@type retry_period: C{int}
Modified: debtorrent/trunk/DebTorrent/BT1/Statistics.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Statistics.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Statistics.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Statistics.py Mon Jul 30 02:26:41 2007
@@ -43,9 +43,9 @@
@ivar rerequest_lastfailed: method to call to check if the last
tracker request failed
@type fdatflag: C{threading.Event}
- @ivar fdatflag: unknown
+ @ivar fdatflag: not used
@type fdatactive: C{boolean}
- @ivar fdatactive: unknown
+ @ivar fdatactive: not used
@type piecescomplete: C{int}
@ivar piecescomplete: the number of complete pieces the last time the
statistics were generated
@@ -88,7 +88,7 @@
@param rerequest_lastfailed: method to call to check if the last
tracker request failed
@type fdatflag: C{threading.Event}
- @param fdatflag: unknown
+ @param fdatflag: not used
"""
Modified: debtorrent/trunk/DebTorrent/BT1/Storage.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Storage.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Storage.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Storage.py Mon Jul 30 02:26:41 2007
@@ -62,8 +62,8 @@
@ivar files: the files list from the info of the metainfo dictionary
@type piece_lengths: C{list} of C{long}
@ivar piece_lengths: the list of piece lengths
- @type doneflag: unknown
- @ivar doneflag: unknown
+ @type doneflag: C{threading.Event}
+ @ivar doneflag: the flag that indicates when the program is to be shutdown
@type disabled: C{list} of C{boolean}
@ivar disabled: list of true for the files that are disabled
@type file_ranges: C{list} of (C{long}, C{long}, C{long}, C{string})
@@ -139,15 +139,13 @@
@param files: the files list from the info of the metainfo dictionary
@type piece_lengths: C{list} of C{long}
@param piece_lengths: the list of piece lengths
- @type doneflag: unknown
- @param doneflag: unknown
+ @type doneflag: C{threading.Event}
+ @param doneflag: the flag that indicates when the program is to be shutdown
@type config: C{dictionary}
@param config: the configuration information
@type disabled_files: C{list} of C{boolean}
@param disabled_files: list of true for the files that are disabled
(optional, default is all files disabled)
- @raise IOError: unknown
- @raise ValueError: unknown
"""
@@ -349,13 +347,7 @@
self.handlebuffer.remove(file)
def sync(self):
- """Synchronize all read/write files to disk.
-
- @raise IOError: unknown
- @raise OSError: unknown
-
- """
-
+ """Synchronize all read/write files to disk."""
for file in self.whandles.keys():
self._sync(file)
@@ -585,6 +577,7 @@
(optional, default is not to flush)
@rtype: L{DebTorrent.piecebuffer.SingleBuffer}
@return: the data that was read
+ @raise IOError: if the read data is not complete
"""
@@ -612,7 +605,7 @@
@type pos: C{long}
@param pos: the offset in the download to start writing at
- @type s: unknown
+ @type s: C{string}
@param s: data to write
"""
Modified: debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py Mon Jul 30 02:26:41 2007
@@ -210,68 +210,83 @@
@type triple_check: C{boolean}
@ivar triple_check: whether to thoroughly check data being written to the disk
@type bgalloc_enabled: C{boolean}
- @ivar bgalloc_enabled: unknown
+ @ivar bgalloc_enabled: whether the allocation of all pieces has been enabled
@type bgalloc_active: C{boolean}
- @ivar bgalloc_active: unknown
+ @ivar bgalloc_active: whether background allocation is in process
@type total_length: C{long}
@ivar total_length: the total length of the download
- @type amount_left: unknown
- @ivar amount_left: unknown
- @type numactive: unknown
- @ivar numactive: unknown
- @type inactive_requests: unknown
- @ivar inactive_requests: unknown
- @type amount_inactive: unknown
- @ivar amount_inactive: unknown
- @type amount_obtained: unknown
- @ivar amount_obtained: unknown
- @type amount_desired: unknown
- @ivar amount_desired: unknown
- @type have: unknown
- @ivar have: unknown
- @type have_cloaked_data: unknown
- @ivar have_cloaked_data: unknown
- @type blocked: unknown
- @ivar blocked: unknown
- @type blocked_holes: unknown
- @ivar blocked_holes: unknown
- @type blocked_movein: unknown
- @ivar blocked_movein: unknown
- @type blocked_moveout: unknown
- @ivar blocked_moveout: unknown
- @type waschecked: unknown
- @ivar waschecked: unknown
- @type places: unknown
- @ivar places: unknown
- @type holes: unknown
- @ivar holes: unknown
- @type stat_active: unknown
- @ivar stat_active: unknown
- @type stat_new: unknown
- @ivar stat_new: unknown
- @type dirty: unknown
- @ivar dirty: unknown
- @type stat_numflunked: unknown
- @ivar stat_numflunked: unknown
- @type stat_numdownloaded: unknown
- @ivar stat_numdownloaded: unknown
- @type stat_numfound: unknown
- @ivar stat_numfound: unknown
- @type download_history: unknown
- @ivar download_history: unknown
- @type failed_pieces: unknown
- @ivar failed_pieces: unknown
- @type out_of_place: unknown
- @ivar out_of_place: unknown
- @type write_buf_max: unknown
- @ivar write_buf_max: unknown
- @type write_buf_size: unknown
- @ivar write_buf_size: unknown
- @type write_buf: unknown
- @ivar write_buf: unknown
- @type write_buf_list: unknown
- @ivar write_buf_list: unknown
- @type initialize_tasks: C{list} of [C{string}, C{int}, C{method, C{method}]
+ @type amount_left: C{long}
+ @ivar amount_left: the amount of the total download that is still left to download
+ @type numactive: C{list} of C{int}
+ @ivar numactive: the number of active requests pending for a piece
+ @type inactive_requests: C{list} of C{int} or C{list} of (C{int}, C{int})
+ @ivar inactive_requests: for each piece, the inactive requests remaining
+ for the piece. Will be 1 if the requests have not yet been generated,
+ None if thee piece has already been downloaded, or a list of offsets
+ within the piece and request lengths.
+ @type amount_inactive: C{length}
+ @ivar amount_inactive: the amount of data that is still in inactive requests
+ @type amount_obtained: C{long}
+ @ivar amount_obtained: the amount of the desired download that has been received
+ @type amount_desired: C{long}
+ @ivar amount_desired: the amount of the total download that is desired
+ @type have: L{DebTorrent.bitfield.Bitfield}
+ @ivar have: the bitfield that this peer has
+ @type have_cloaked_data: (C{string}, C{list} of C{int})
+ @ivar have_cloaked_data: the cached incomplete bitfiled as a binary string,
+ and the haves needed to complete it, or None if it has not yet been generated
+ @type blocked: C{list} of C{boolean}
+ @ivar blocked: whether the piece location is blocked
+ @type blocked_holes: C{list} of C{int}
+ @ivar blocked_holes: the holes that have been blocked
+ @type blocked_movein: L{Olist}
+ @ivar blocked_movein: the piece locations that are currently blocking a
+ piece from moving into its proper place
+ @type blocked_moveout: L{Olist}
+ @ivar blocked_moveout: the pieces that are currently blocked from moving
+ into their proper place
+ @type waschecked: C{list} of C{boolean}
+ @ivar waschecked: whether the piece has been hash checked
+ @type places: C{dictionary}
+ @ivar places: keys are the pieces, values are their current piece locations
+ @type holes: C{list} of C{int}
+ @ivar holes: the piece locations that are currently empty and unallocated
+ @type stat_active: C{dictionary}
+ @ivar stat_active: keys are the pieces that currently have active requests
+ @type stat_new: C{dictionary}
+ @ivar stat_new: keys are the pieces that have a newly sent request but
+ have not downloaded anything
+ @type dirty: C{dictionary}
+ @ivar dirty: keys are the pieces that have received partial downloads,
+ values are a list of the offset within the piece and length of the
+ partial downloads received
+ @type stat_numflunked: C{int}
+ @ivar stat_numflunked: the number of downloaded pieces that have failed a hash check
+ @type stat_numdownloaded: C{int}
+ @ivar stat_numdownloaded: total number of pieces that have successfully downloaded
+ @type stat_numfound: C{int}
+ @ivar stat_numfound: number of pieces that were found from a previous download
+ @type download_history: C{dictionary}
+ @ivar download_history: keys are downloaded pieces, values are dictionaries
+ with keys of the request offset within the piece and values of the
+ source of the download
+ @type failed_pieces: C{dictionary}
+ @ivar failed_pieces: keys are downloaded pieces, values are dictionaries
+ with keys of the source of the download
+ @type out_of_place: C{int}
+ @ivar out_of_place: for sparse allocation, the number of pieces that are
+ out of place during initialization
+ @type write_buf_max: C{long}
+ @ivar write_buf_max: the maximum number of bytes to store in the piece buffer
+ @type write_buf_size: C{long}
+ @ivar write_buf_size: the current number of bytes stored in the piece buffer
+ @type write_buf: C{dictionary}
+ @ivar write_buf: keys are pieces in the piece buffer, values are lists of
+ the offset within the piece and the piece data: [(start, data), ...]
+ @type write_buf_list: C{list} of C{int}
+ @ivar write_buf_list: the pieces currently in the piece buffer, ordered
+ so that the most recently received piece is at the end of the list
+ @type initialize_tasks: C{list} of [C{string}, C{int}, C{method}, C{method}]
@ivar initialize_tasks: the initialization tasks to perform, the status message,
initial fraction done, method to call to initialize the task, and the task
@type initialize_done: C{method}
@@ -280,61 +295,41 @@
@ivar initialize_status: method to call to report the status of the initialization
@type initialize_next: C{method}
@ivar initialize_next: current method to call in the initialization tasks
- @type check_list: unknown
- @ivar check_list: unknown
- @type check_total: unknown
- @ivar check_total: unknown
- @type check_targets: unknown
- @ivar check_targets: unknown
- @type check_numchecked: unknown
- @ivar check_numchecked: unknown
- @type numchecked: unknown
- @ivar numchecked: unknown
- @type movelist: unknown
- @ivar movelist: unknown
- @type tomove: unknown
- @ivar tomove: unknown
- @type numholes: unknown
- @ivar numholes: unknown
- @type alloc_buf: unknown
- @ivar alloc_buf: unknown
+ @type check_list: C{list} of C{int}
+ @ivar check_list: the pieces needing hash checking during initialization
+ @type check_total: C{int}
+ @ivar check_total: the number of pieces needing hash checking during initialization
+ @type check_targets: C{dictionary}
+ @ivar check_targets: keys are piece hashes, values are a list of potential pieces
+ @type check_numchecked: C{float}
+ @ivar check_numchecked: not used
+ @type numchecked: C{float}
+ @ivar numchecked: the number of pieces that have been hash checked during initialization
+ @type movelist: C{list} of C{int}
+ @ivar movelist: for sparse allocation, the pieces that need to be moved
+ during initialization
+ @type tomove: C{float}
+ @ivar tomove: for sparse allocation, the numebr of pieces that still need
+ to be moved during initialization
+ @type numholes: C{int}
+ @ivar numholes: the number of holes that need to be filled by allocation
+ during initialization
+ @type alloc_buf: C{string}
+ @ivar alloc_buf: dummy data to write to allocated but not downloaded
+ piece locations
@group Initialization: __init__, _bgsync, old_style_init, initialize,
_initialize, init_hashcheck, _markgot, hashcheckfunc, init_movedata,
movedatafunc, init_alloc, _allocfunc, allocfunc, bgalloc, _bgalloc
-_waspre
-_piecelen
-get_amount_left
-do_I_have_anything
-_make_inactive
-is_endgame
-am_I_complete
-reset_endgame
-get_have_list
-get_have_list_cloaked
-do_I_have
-do_I_have_requests
-is_unstarted
-get_hash
-get_stats
-new_request
-write_raw
-_write_to_buffer
-_flush_buffer
-sync
-_move_piece
-_clear_space
-piece_came_in
-request_lost
-get_piece
-read_raw
-set_file_readonly
-has_data
-doublecheck_data
-reblock
-pickle
-unpickle
-
+ @group Information: _waspre, _piecelen, get_amount_left, do_I_have_anything,
+ am_I_complete, get_have_list, get_have_list_cloaked, do_I_have,
+ get_hash, get_stats
+ @group Requests: _make_inactive, new_request, request_lost,
+ do_I_have_requests, is_unstarted, is_endgame, reset_endgame
+ @group Read/Write: write_raw, _write_to_buffer, _flush_buffer, sync,
+ _move_piece, _clear_space, piece_came_in, get_piece, read_raw,
+ set_file_readonly
+ @group Resuming: has_data, doublecheck_data, reblock, pickle, unpickle
"""
@@ -438,7 +433,7 @@
self.out_of_place = 0
self.write_buf_max = config['write_buffer_size']*1048576L
self.write_buf_size = 0L
- self.write_buf = {} # structure: piece: [(start, data), ...]
+ self.write_buf = {}
self.write_buf_list = []
self.initialize_tasks = [
@@ -491,7 +486,7 @@
@param donefunc: method to call when the initialization is complete
@type statusfunc: C{method}
@param statusfunc: method to call to report the status of the initialization
- (optional, defaults to using L{StorageWrapper.statusfunc})
+ (optional, defaults to using L{statusfunc})
"""
@@ -650,7 +645,7 @@
def init_movedata(self):
- """Initialize the move data initialization task.
+ """Initialize the move data initialization task (only for sparse allocation).
@rtype: C{boolean}
@return: whether the task should proceed
@@ -716,6 +711,9 @@
def init_alloc(self):
"""Initialize the allocation initialization task.
+ Only runs if the allocation type is pre-allocate, or background and
+ there are pieces waiting to move into their proper place.
+
@rtype: C{boolean}
@return: whether the task should proceed
@@ -747,7 +745,7 @@
while self.holes:
n = self.holes.pop(0)
- if self.blocked[n]: # assume not self.blocked[index]
+ if self.blocked[n]:
if not self.blocked_movein:
self.blocked_holes.append(n)
continue
@@ -764,7 +762,10 @@
return None
def allocfunc(self):
- """Allocate space for files as part of the initialization tasks.
+ """Allocate space for pieces.
+
+ Allocation is done both as part of the initial startup (see L{init_alloc}),
+ and also periodically (see L{_bgalloc}).
@rtype: C{float}
@return: the fraction of the task that is complete, or None if the
@@ -800,7 +801,7 @@
return None
def bgalloc(self):
- """Enable the backround allocation.
+ """Enable the backround allocation of all pieces.
@rtype: C{boolean}
@return: False
@@ -824,18 +825,57 @@
def _waspre(self, piece):
+ """Determine if the piece has been pre-allocated.
+
+ @type piece: C{int}
+ @param piece: the piece to check
+ @rtype: C{boolean}
+ @return: whether a storage location for the piece has been allocated
+
+ """
+
return self.storage.was_preallocated(self.piece_begins[piece], self._piecelen(piece))
def _piecelen(self, piece):
+ """Get the size of a piece.
+
+ @type piece: C{int}
+ @param piece: the piece to get the size of
+ @rtype: C{int}
+ @return: the size of the piece
+
+ """
+
return self.piece_sizes[piece]
def get_amount_left(self):
+ """Determine the amount of the download still remaining.
+
+ @rtype: C{long}
+ @return: the amount still remaining to download
+
+ """
+
return self.amount_left
def do_I_have_anything(self):
+ """Determine if anything has been downloaded.
+
+ @rtype: C{boolean}
+ @return: whether anything has been downloaded
+
+ """
+
return self.amount_left < self.total_length
def _make_inactive(self, index):
+ """Create the list of inactive requests for a piece.
+
+ @type index: C{int}
+ @param index: the piece to make the inactive list for
+
+ """
+
length = self._piecelen(index)
l = []
x = 0
@@ -846,19 +886,67 @@
self.inactive_requests[index] = l
def is_endgame(self):
+ """Determine if the download is in end-game mode.
+
+ End-game mode occurs when there are pending requests for all the
+ chunks of pieces in the download.
+
+ @rtype: C{boolean}
+ @return: whether the download is in end-game mode
+
+ """
+
return not self.amount_inactive
def am_I_complete(self):
+ """Determine if the download is currently complete.
+
+ Complete here means that all the pieces that are desired have been
+ downloaded, not that all possible pieces ahve been downloaded.
+
+ @rtype: C{boolean}
+ @return: whether the download is complete
+
+ """
+
return self.amount_obtained == self.amount_desired
def reset_endgame(self, requestlist):
+ """Reset all lost requests to inactive.
+
+ Only occurs as the result of a loss of all peers, or a pause during
+ end-game mode.
+
+ @type requestlist: C{list} of (C{int}, C{int}, C{int})
+ @param requestlist: the requests that were lost, the piece index,
+ offset within the piece, and length of the request
+
+ """
+
for index, begin, length in requestlist:
self.request_lost(index, begin, length)
def get_have_list(self):
+ """Get this peer's bitfield as a string.
+
+ @rtype: C{string}
+ @return: the have list as a binary string
+
+ """
+
return self.have.tostring()
def get_have_list_cloaked(self):
+ """Get this peer's incomplete bitfield as a string, and a have list.
+
+ Random bits are removed from the bitfield and added to the list of haves.
+
+ @rtype: (C{string}, C{list} of C{int})
+ @return: the incomplete bitfiled as a binary string, and the haves to
+ complete it
+
+ """
+
if self.have_cloaked_data is None:
newhave = Bitfield(copyfrom = self.have)
unhaves = []
@@ -872,23 +960,75 @@
return self.have_cloaked_data
def do_I_have(self, index):
+ """Determine if the piece has been downloaded.
+
+ @type index: C{int}
+ @param index: the piece to check
+ @rtype: C{boolean}
+ @return: whether the piece has been downloaded
+
+ """
+
return self.have[index]
def do_I_have_requests(self, index):
+ """Determine if the piece has requests that could be sent out.
+
+ @type index: C{int}
+ @param index: the piece to check
+ @rtype: C{boolean}
+ @return: whether the piece has unsent requests to send
+
+ """
+
return not not self.inactive_requests[index]
def is_unstarted(self, index):
+ """Determine if the piece has been started downloading.
+
+ @type index: C{int}
+ @param index: the piece to check
+ @rtype: C{boolean}
+ @return: whether the piece has been started
+
+ """
+
return ( not self.have[index] and not self.numactive[index]
and not self.dirty.has_key(index) )
def get_hash(self, index):
+ """Get the piece's hash.
+
+ @type index: C{int}
+ @param index: the piece to get the hash of
+ @rtype: C{string}
+ @return: the SHA1 hash of the piece
+
+ """
+
return self.hashes[index]
def get_stats(self):
+ """Get some statistics about the download.
+
+ @rtype: C{long}, C{long}
+ @return: the amount of the download that has been completed, and the
+ amount that is still desired to be downloaded
+
+ """
+
return self.amount_obtained, self.amount_desired
def new_request(self, index):
- # returns (begin, length)
+ """Get a new request for the piece.
+
+ @type index: C{int}
+ @param index: the piece to get a request for
+ @rtype: C{int}, C{int}
+ @return: the offset within the piece and length of the request
+
+ """
+
if self.inactive_requests[index] == 1:
self._make_inactive(index)
self.numactive[index] += 1
@@ -904,6 +1044,19 @@
def write_raw(self, index, begin, data):
+ """Write some data for the piece to disk.
+
+ @type index: C{int}
+ @param index: the piece to write to
+ @type begin: C{int}
+ @param begin: the offset within the piece to start writing at
+ @type data: C{string}
+ @param data: the data to write
+ @rtype: C{boolean}
+ @return: whether the write was successful
+
+ """
+
try:
self.storage.write(self.piece_begins[index] + begin, data)
return True
@@ -913,6 +1066,23 @@
def _write_to_buffer(self, piece, start, data):
+ """Write some data to the piece buffer.
+
+ If the piece buffer has exceeded the maximum, the oldest pieces in it
+ are first flushed to disk to make space. If the maximum write buffer
+ size is set to 0, the data is immediately written to disk.
+
+ @type piece: C{int}
+ @param piece: the piece buffer to write to
+ @type start: C{int}
+ @param start: the offset within the piece to start writing at
+ @type data: C{string}
+ @param data: the data to write
+ @rtype: C{boolean}
+ @return: whether the write was successful
+
+ """
+
if not self.write_buf_max:
return self.write_raw(self.places[piece], start, data)
self.write_buf_size += len(data)
@@ -929,6 +1099,18 @@
return True
def _flush_buffer(self, piece, popped = False):
+ """Flush the piece in the buffer to disk.
+
+ @type piece: C{int}
+ @param piece: the piece buffer to write to disk
+ @type popped: C{boolean}
+ @param popped: whether the piece was already removed from
+ the write_buf_list (optional, defaults to False)
+ @rtype: C{boolean}
+ @return: whether the flush was successful
+
+ """
+
if not self.write_buf.has_key(piece):
return True
if not popped:
@@ -943,6 +1125,7 @@
return True
def sync(self):
+ """Flush all the buffered pieces to disk in order by their current place in the download."""
spots = {}
for p in self.write_buf_list:
spots[self.places[p]] = p
@@ -962,6 +1145,20 @@
def _move_piece(self, index, newpos):
+ """Move a piece from it's current location to a new one.
+
+ The piece hash may be double checked if this is it's final position,
+ or triple checked regardless.
+
+ @type index: C{int}
+ @param index: the piece to move
+ @type newpos: C{int}
+ @param newpos: new position to move the piece to
+ @rtype: C{int}
+ @return: the old position od the piece, or -1 if an error occurred
+
+ """
+
oldpos = self.places[index]
logging.debug('moving '+str(index)+' from '+str(oldpos)+' to '+str(newpos))
assert oldpos != index
@@ -1002,6 +1199,20 @@
return oldpos
def _clear_space(self, index):
+ """Clear a space for a new piece to be written to the storage.
+
+ If the proper place is available it will use it, otherwise a new
+ place is created. The new place is alos first checked to make
+ sure a piece is not waiting to be moved in there.
+
+ @type index: C{int}
+ @param index: the piece that needs a space
+ @rtype: C{boolean}
+ @return: whether the function needs to be called again to complete the
+ operation
+
+ """
+
h = self.holes.pop(0)
n = h
if self.blocked[n]: # assume not self.blocked[index]
@@ -1046,6 +1257,24 @@
def piece_came_in(self, index, begin, piece, source = None):
+ """Process some received data for a piece.
+
+ If this is the first data for a piece, it will first clear a space for
+ the piece. If the piece is complete then the data structures are
+ cleaned up, and the data is flushed to disk and hash checked.
+
+ @type index: C{int}
+ @param index: the piece that data was received for
+ @type begin: C{int}
+ @param begin: the offset within the piece that the data starts at
+ @type piece: C{string}
+ @param piece: the data that was received
+ @rtype: C{boolean}
+ @return: False if the piece is complete but failed the hash check,
+ otherwise returns True
+
+ """
+
assert not self.have[index]
if not self.places.has_key(index):
@@ -1134,6 +1363,17 @@
def request_lost(self, index, begin, length):
+ """Add a lost request back to the list of inactive requests.
+
+ @type index: C{int}
+ @param index: the piece requested
+ @type begin: C{int}
+ @param begin: the offset within the piece of the request
+ @type length: C{int}
+ @param length: the length of the request
+
+ """
+
assert not (begin, length) in self.inactive_requests[index]
insort(self.inactive_requests[index], (begin, length))
self.amount_inactive += length
@@ -1145,6 +1385,22 @@
def get_piece(self, index, begin, length):
+ """Get a chunk of a piece.
+
+ If the piece has never been hash checked, the whole piece will be read
+ and checked first. Otherwise only the requested data will be read.
+
+ @type index: C{int}
+ @param index: the piece requested
+ @type begin: C{int}
+ @param begin: the offset within the piece of the request
+ @type length: C{int}
+ @param length: the length of the request
+ @rtype: C{string}
+ @return: the requested data, or None if there was a problem
+
+ """
+
if not self.have[index]:
return None
data = None
@@ -1178,6 +1434,22 @@
return s
def read_raw(self, piece, begin, length, flush_first = False):
+ """Read some piece data from the disk.
+
+ @type piece: C{int}
+ @param piece: the piece requested
+ @type begin: C{int}
+ @param begin: the offset within the piece of the request
+ @type length: C{int}
+ @param length: the length of the request
+ @type flush_first: C{boolean}
+ @param flush_first: whether to flush the files before reading the data
+ (optional, default is not to flush)
+ @rtype: C{string}
+ @return: the requested data, or None if there was a problem
+
+ """
+
try:
return self.storage.read(self.piece_begins[piece] + begin,
length, flush_first)
@@ -1187,6 +1459,13 @@
def set_file_readonly(self, n):
+ """Sync a file to disk and set it read only.
+
+ @type n: C{int}
+ @param n: the file index to set read only
+
+ """
+
try:
self.storage.set_readonly(n)
except IOError, e:
@@ -1196,9 +1475,27 @@
def has_data(self, index):
+ """Determine whether a piece location has data in it.
+
+ @type index: C{int}
+ @param index: the piece location to check
+ @rtype: C{boolean}
+ @return: whether the location has data in it
+
+ """
+
return index not in self.holes and index not in self.blocked_holes
def doublecheck_data(self, pieces_to_check):
+ """Double check all the listed pieces hashes.
+
+ @type pieces_to_check: C{dictionary}
+ @param pieces_to_check: keys are the piece indexes to hash check
+ @rtype: C{boolean}
+ @return: whether all the pieces passed the hash check
+
+ """
+
if not self.double_check:
return
sources = []
@@ -1221,7 +1518,15 @@
def reblock(self, new_blocked):
- # assume downloads have already been canceled and chunks made inactive
+ """Recreate the various blocked lists based on new blocked pieces.
+
+ Assume downloads have already been canceled and chunks made inactive.
+
+ @type new_blocked: C{list} of C{boolean}
+ @param new_blocked: whether the pieces are now blocked
+
+ """
+
for i in xrange(len(new_blocked)):
if new_blocked[i] and not self.blocked[i]:
length = self._piecelen(i)
@@ -1269,30 +1574,36 @@
self.blocked_holes = []
- '''
- Pickled data format:
-
- d['pieces'] = either a string containing a bitfield of complete pieces,
- or the numeric value "1" signifying a seed. If it is
- a seed, d['places'] and d['partials'] should be empty
- and needn't even exist.
- d['partials'] = [ piece, [ offset, length... ]... ]
- a list of partial data that had been previously
- downloaded, plus the given offsets. Adjacent partials
- are merged so as to save space, and so that if the
- request size changes then new requests can be
- calculated more efficiently.
- d['places'] = [ piece, place, {,piece, place ...} ]
- the piece index, and the place it's stored.
- If d['pieces'] specifies a complete piece or d['partials']
- specifies a set of partials for a piece which has no
- entry in d['places'], it can be assumed that
- place[index] = index. A place specified with no
- corresponding data in d['pieces'] or d['partials']
- indicates allocated space with no valid data, and is
- reserved so it doesn't need to be hash-checked.
- '''
def pickle(self):
+ """Pickle the current state for later resuming.
+
+ Pickled data format::
+
+ d['pieces'] = either a string containing a bitfield of complete pieces,
+ or the numeric value "1" signifying a seed. If it is
+ a seed, d['places'] and d['partials'] should be empty
+ and needn't even exist.
+ d['partials'] = [ piece, [ offset, length... ]... ]
+ a list of partial data that had been previously
+ downloaded, plus the given offsets. Adjacent partials
+ are merged so as to save space, and so that if the
+ request size changes then new requests can be
+ calculated more efficiently.
+ d['places'] = [ piece, place, {,piece, place ...} ]
+ the piece index, and the place it's stored.
+ If d['pieces'] specifies a complete piece or d['partials']
+ specifies a set of partials for a piece which has no
+ entry in d['places'], it can be assumed that
+ place[index] = index. A place specified with no
+ corresponding data in d['pieces'] or d['partials']
+ indicates allocated space with no valid data, and is
+ reserved so it doesn't need to be hash-checked.
+
+ @rtype: C{dictionary}
+ @return: the pickled state
+
+ """
+
if self.have.complete():
return {'pieces': 1}
pieces = Bitfield(len(self.hashes))
@@ -1326,6 +1637,18 @@
def unpickle(self, data, valid_places):
+ """Unpickle the state for resuming.
+
+ @type data: C{dictionary}
+ @param data: the pickled state (see L{pickle})
+ @type valid_places: C{list} of C{int}
+ @param valid_places: the pieces that are still considered valid based
+ on their modification time and size
+ @rtype: C{list} of C{int}
+ @return: the pieces that are partially downloaded
+
+ """
+
got = {}
places = {}
dirty = {}
Modified: debtorrent/trunk/DebTorrent/BT1/makemetafile.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/makemetafile.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/makemetafile.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/makemetafile.py Mon Jul 30 02:26:41 2007
@@ -498,8 +498,8 @@
@param dir: the directory to find files in
@type url: C{string}
@param url: the announce address to use for the torrents
- @type params: unknown
- @param params: unknown
+ @type params: C{dictionary}
+ @param params: the configuration options (optional, defaults to None)
@type vc: C{method}
@param vc: progress report while the torrent generation is underway
@type fc: C{method}
Modified: debtorrent/trunk/DebTorrent/BT1/track.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/track.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/track.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/track.py Mon Jul 30 02:26:41 2007
@@ -6,7 +6,7 @@
"""Tools to track a download swarm.
- at type defaults: C{list} of (C{string}, C{unknown}, C{string})
+ at type defaults: C{list} of (C{string}, unknown, C{string})
@var defaults: the parameter names, default values, and descriptions
@type alas: C{string}
@var alas: the message to send when the data is not found
@@ -277,8 +277,8 @@
@type config: C{dictionary}
@ivar config: the configuration parameters
- @type response_size: unknown
- @ivar response_size: unknown
+ @type response_size: C{int}
+ @ivar response_size: default number of peers to send in an info message
@type configdir: L{DebTorrent.ConfigDir.ConfigDir}
@ivar configdir: the configuration and cache directory manager
@type natcheck: C{int}
@@ -294,30 +294,35 @@
@ivar cached: unknown
@type cached_t: unknown
@ivar cached_t: unknown
- @type times: unknown
- @ivar times: unknown
+ @type times: C{dictionary}
+ @ivar times: keys are info hashes, values are dictionaries with keys the
+ peer IDs of peers connected to that torrent and values the last time
+ the peer was seen
@type state: C{dictionary}
@ivar state: the current state information for the tracking
- @type seedcount: unknown
- @ivar seedcount: unknown
- @type allowed_IPs: unknown
- @ivar allowed_IPs: unknown
- @type banned_IPs: unknown
- @ivar banned_IPs: unknown
- @type allowed_ip_mtime: unknown
- @ivar allowed_ip_mtime: unknown
- @type banned_ip_mtime: unknown
- @ivar banned_ip_mtime: unknown
+ @type seedcount: C{dictionary}
+ @ivar seedcount: keys are info hashes, values are the number of seeds
+ connected to that torrent
+ @type allowed_IPs: L{DebTorrent.subnetparse.IP_List}
+ @ivar allowed_IPs: the IPs that are allowed to connect, or None if all are
+ @type banned_IPs: L{DebTorrent.iprangeparse.IP_List}
+ @ivar banned_IPs: the IPs that are not allowed to connect
+ @type allowed_ip_mtime: C{int}
+ @ivar allowed_ip_mtime: the last modification time of the allowed IPs file
+ @type banned_ip_mtime: C{int}
+ @ivar banned_ip_mtime: the last modification time of the banned IPs file
@type only_local_override_ip: C{boolean}
@ivar only_local_override_ip: whether to ignore the "ip" parameter from
machines which aren't on local network IPs
- @type downloads: unknown
- @ivar downloads: unknown
- @type completed: unknown
- @ivar completed: unknown
+ @type downloads: C{dictionary}
+ @ivar downloads: keys are info hashes, values are dictionaries with keys the
+ peer IDs of peers connected to that torrent and values the dictionaries
+ of information about the peer
+ @type completed: C{dictionary}
+ @ivar completed: keys are info hashes, values are the number of peers that
+ have completed downloading the entire torrent
@type becache: C{list} of C{list} of C{dictionary}
@ivar becache: keys are the infohashes, values are the cached peer data.
-
peer set format::
[[l0, s0], [l1, s1], ...]
l,s = dictionaries of leechers and seeders (by peer ID)
@@ -327,52 +332,55 @@
additionally, if --compact_reqd = 0:
l3,s3 = [ip,port,peerid] for all peers
l4,l4 = [ip,port] for all peers
- @type cache_default: unknown
- @ivar cache_default: unknown
- @type trackerid: unknown
- @ivar trackerid: unknown
+ @type cache_default: C{list} of (C{dictionary}, C{dictionary})
+ @ivar cache_default: the default cache entry for new caches
+ @type trackerid: C{string}
+ @ivar trackerid: the randomly generated tracker ID of this tracker
@type reannounce_interval: C{int}
@ivar reannounce_interval: seconds downloaders should wait between reannouncements
@type save_state_interval: C{int}
@ivar save_state_interval: seconds between saving the state file
@type show_names: C{boolean}
@ivar show_names: whether to display names from allowed dir
- @type prevtime: unknown
- @ivar prevtime: unknown
+ @type prevtime: C{float}
+ @ivar prevtime: the last time downloaders were expired from the cache
@type timeout_downloaders_interval: C{int}
@ivar timeout_downloaders_interval: seconds between expiring downloaders
- @type allow_get: unknown
- @ivar allow_get: unknown
+ @type allow_get: C{boolean}
+ @ivar allow_get: whether torrets can be downloaded from the info page
@type t2tlist: L{T2T.T2TList}
- @ivar t2tlist: unknown
- @type allowed: unknown
- @ivar allowed: unknown
- @type allowed_list_mtime: unknown
- @ivar allowed_list_mtime: unknown
- @type allowed_dir_files: unknown
- @ivar allowed_dir_files: unknown
- @type allowed_dir_blocked: unknown
- @ivar allowed_dir_blocked: unknown
- @type uq_broken: unknown
- @ivar uq_broken: unknown
- @type keep_dead: unknown
- @ivar keep_dead: unknown
- @type Filter: unknown
- @ivar Filter: unknown
- @type is_aggregator: unknown
- @ivar is_aggregator: unknown
- @type aggregator_key: unknown
- @ivar aggregator_key: unknown
- @type aggregate_forward: unknown
- @ivar aggregate_forward: unknown
- @type aggregate_password: unknown
- @ivar aggregate_password: unknown
- @type dedicated_seed_id: unknown
- @ivar dedicated_seed_id: unknown
- @type is_seeded: unknown
- @ivar is_seeded: unknown
- @type cachetime: unknown
- @ivar cachetime: unknown
+ @ivar t2tlist: the list of tracker to tracker connections
+ @type allowed: C{dictionary}
+ @ivar allowed: the torrents that are allowed to be tracked, keys are the
+ info hashes, values are the torrent data
+ @type allowed_list_mtime: C{int}
+ @ivar allowed_list_mtime: the last modification time of the list of allowed
+ torrents file
+ @type allowed_dir_files: C{dictionary}
+ @ivar allowed_dir_files: torrent files found in the allowed directory
+ @type allowed_dir_blocked: C{dictionary}
+ @ivar allowed_dir_blocked: unparseable torrent files found in the allowed directory
+ @type uq_broken: C{boolean}
+ @ivar uq_broken: whether URL quoting of '+' is broken
+ @type keep_dead: C{boolean}
+ @ivar keep_dead: whether to keep dead torrents after they expire
+ @type Filter: L{Filter.Filter}
+ @ivar Filter: the filter to use for disallowing connecting peers
+ @type is_aggregator: C{boolean}
+ @ivar is_aggregator: whether to act as a data aggregator rather than a tracker
+ @type aggregator_key: C{string}
+ @ivar aggregator_key: the password to use to verify connecting trackers
+ @type aggregate_forward: C{string}
+ @ivar aggregate_forward: URL to forward all non-multitracker connections to
+ @type aggregate_password: C{string}
+ @ivar aggregate_password: password to use when forwarding non-multitracker connections
+ @type dedicated_seed_id: C{string}
+ @ivar dedicated_seed_id: dedicated seed ID to expect from clients
+ @type is_seeded: C{dictionary}
+ @ivar is_seeded: keys are info hashes, values are true if the torrent has
+ a dedicated seed connected
+ @type cachetime: C{int}
+ @ivar cachetime: elasped time since starting for caclulating cache refreshes
"""
@@ -1118,7 +1126,7 @@
calling the helper functions above if needed. Return the response to
be returned to the requester.
- @type connection: unknown
+ @type connection: L{DebTorrent.HTTPHandler.HTTPConnection}
@param connection: the conection the request came in on
@type path: C{string}
@param path: the URL being requested
Modified: debtorrent/trunk/DebTorrent/BTcrypto.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BTcrypto.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BTcrypto.py (original)
+++ debtorrent/trunk/DebTorrent/BTcrypto.py Mon Jul 30 02:26:41 2007
@@ -11,8 +11,8 @@
@var KEY_LENGTH: the length of the keys to generate
@type DH_PRIME: C{long}
@var DH_PRIME: a very large prime number
- at type PAD_MAX: unknown
- at var PAD_MAX: unknown
+ at type PAD_MAX: C{int}
+ at var PAD_MAX: the maximum amount of padding to add to the encryptes protocol header
@type DH_BYTES: C{int}
@var DH_BYTES: the number of bytes to use for key lengths
@@ -83,16 +83,16 @@
@ivar pubkey: public key corresponding to the private key
@type keylength: C{int}
@ivar keylength: the key length to use
- @type _VC_pattern: unknown
- @ivar _VC_pattern: unknown
- @type S: unknown
- @ivar S: unknown
- @type block3a: unknown
- @ivar block3a: unknown
- @type block3bkey: unknown
- @ivar block3bkey: unknown
- @type block3b: unknown
- @ivar block3b: unknown
+ @type _VC_pattern: C{string}
+ @ivar _VC_pattern: the encrypted verification constant to expect from the peer
+ @type S: C{string}
+ @ivar S: the DH secret number, encoded as a byte array
+ @type block3a: C{string}
+ @ivar block3a: first encryption block
+ @type block3bkey: C{string}
+ @ivar block3bkey: key used to generate the second encryption block
+ @type block3b: C{string}
+ @ivar block3b: seconf encryption block
@type encrypt: C{method}
@ivar encrypt: the method to call to encrypt data
@type decrypt: C{method}
@@ -142,7 +142,7 @@
"""
@type SKEY: C{string}
- @param SKEY: unknown
+ @param SKEY: shared key (torrent info hash)
"""
@@ -154,9 +154,9 @@
"""Check that the encoding matches the encoded value.
@type s: C{string}
- @param s: unknown
+ @param s: second received encryption block to verify
@type SKEY: C{string}
- @param SKEY: unknown
+ @param SKEY: shared key (torrent info hash)
@rtype: C{boolean}
@return: whether the encoding of SKEY matches s
@@ -174,7 +174,7 @@
"""
@type SKEY: C{string}
- @param SKEY: unknown
+ @param SKEY: shared key (torrent info hash)
"""
@@ -194,8 +194,8 @@
def VC_pattern(self):
"""Unknown.
- @rtype: unknown
- @return: unknown
+ @rtype: C{string}
+ @return: the encrypted verification constant to expect from the peer
"""
if not self._VC_pattern:
Modified: debtorrent/trunk/DebTorrent/ConfigDir.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/ConfigDir.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/ConfigDir.py (original)
+++ debtorrent/trunk/DebTorrent/ConfigDir.py Mon Jul 30 02:26:41 2007
@@ -126,7 +126,8 @@
@type statefile: C{string}
@ivar statefile: the file name for the saved state
@type TorrentDataBuffer: C{dictionary}
- @ivar TorrentDataBuffer: unknown
+ @ivar TorrentDataBuffer: any torrent data read/written, keys are the
+ torrent info hashes, values are the torrent data (C{dictionary})
@type config: C{dictionary}
@ivar config: the current configuration variables
@@ -346,7 +347,7 @@
def getState(self):
"""Get the state from the state file.
- @rtype: unknown
+ @rtype: C{dictionary}
@return: the previosuly saved state, or None if there was no previously
saved state
@@ -370,7 +371,7 @@
def saveState(self, state):
"""Saves the state to the state file.
- @type state: unknown
+ @type state: C{dictionary}
@param state: the state to save
@rtype: boolean
@return: whether the saving was successful
Modified: debtorrent/trunk/DebTorrent/HTTPHandler.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/HTTPHandler.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/HTTPHandler.py (original)
+++ debtorrent/trunk/DebTorrent/HTTPHandler.py Mon Jul 30 02:26:41 2007
@@ -52,28 +52,28 @@
@type handler: L{HTTPHandler}
@ivar handler: the handler for all incoming HTTP connections
- @type connection: unknown
+ @type connection: L{SocketHandler.SingleSocket}
@ivar connection: the new connection that was created
@type buf: C{string}
- @ivar buf: unknown
+ @ivar buf: the buffered data received on the connection
@type closed: C{boolean}
- @ivar closed: unknown
+ @ivar closed: whether the connection has been closed
@type done: C{boolean}
- @ivar done: unknown
+ @ivar done: whether the response has been sent
@type donereading: C{boolean}
- @ivar donereading: unknown
+ @ivar donereading: whether the headers have been read
@type next_func: C{method}
@ivar next_func: the next method to call to process data on this connection
- @type header: unknown
- @ivar header: unknown
- @type command: unknown
- @ivar command: unknown
- @type pre1: unknown
- @ivar pre1: unknown
- @type headers: unknown
- @ivar headers: unknown
- @type encoding: unknown
- @ivar encoding: unknown
+ @type header: C{string}
+ @ivar header: the first header line received from the request
+ @type command: C{string}
+ @ivar command: the requested command ('GET' or 'HEAD')
+ @type pre1: C{boolean}
+ @ivar pre1: whether the request is from a pre version 1.0 client
+ @type headers: C{dictionary}
+ @ivar headers: the headers received with the request
+ @type encoding: C{string}
+ @ivar encoding: the encoding to use when sending the response
"""
@@ -82,7 +82,7 @@
@type handler: L{HTTPHandler}
@param handler: the handler for all incoming HTTP connections
- @type connection: unknown
+ @type connection: L{SocketHandler.SingleSocket}
@param connection: the new connection that was created
"""
@@ -306,7 +306,7 @@
def external_connection_made(self, connection):
"""Create a new HTTPConnection object.
- @type connection: unknown
+ @type connection: L{SocketHandler.SingleSocket}
@param connection: the connection
"""
@@ -316,7 +316,7 @@
def connection_flushed(self, connection):
"""Flush a connection.
- @type connection: unknown
+ @type connection: L{SocketHandler.SingleSocket}
@param connection: the connection
"""
@@ -327,7 +327,7 @@
def connection_lost(self, connection):
"""Remove the lost connection from the existing ones.
- @type connection: unknown
+ @type connection: L{SocketHandler.SingleSocket}
@param connection: the connection
"""
@@ -341,7 +341,7 @@
def data_came_in(self, connection, data):
"""Process incoming data on an existing connection.
- @type connection: unknown
+ @type connection: L{SocketHandler.SingleSocket}
@param connection: the connection
@type data: C{string}
@param data: the data that came in
@@ -361,7 +361,7 @@
@type ident: C{string}
@param ident: the type of connection
@type username: C{string}
- @param username: unknown
+ @param username: the username from the client
@type header: C{string}
@param header: the first header line of the request
@type responsecode: C{int}
Modified: debtorrent/trunk/DebTorrent/RateLimiter.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/RateLimiter.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/RateLimiter.py (original)
+++ debtorrent/trunk/DebTorrent/RateLimiter.py Mon Jul 30 02:26:41 2007
@@ -6,34 +6,40 @@
"""Limit the upload rate.
+All the constants below are only for the automatic upload rate adjustment.
+
@type MAX_RATE_PERIOD: C{float}
- at var MAX_RATE_PERIOD: unknown
+ at var MAX_RATE_PERIOD: maximum amount of time to guess the current rate
+ estimate represents
@type MAX_RATE: C{float}
@var MAX_RATE: the (very large) limit to use to not limit the upload rate
- at type PING_BOUNDARY: C{int}
- at var PING_BOUNDARY: unknown
+ at type PING_BOUNDARY: C{float}
+ at var PING_BOUNDARY: maximum ping time to consider still working
@type PING_SAMPLES: C{int}
- at var PING_SAMPLES: unknown
+ at var PING_SAMPLES: minimum number of pings to require
@type PING_DISCARDS: C{int}
- at var PING_DISCARDS: unknown
+ at var PING_DISCARDS: number of initial pings to discard
@type PING_THRESHHOLD: C{int}
- at var PING_THRESHHOLD: unknown
+ at var PING_THRESHHOLD: number of pings that exceed L{PING_BOUNDARY} before the
+ connection is assumed to be flooded
@type PING_DELAY: C{int}
- at var PING_DELAY: unknown
+ at var PING_DELAY: not used
@type PING_DELAY_NEXT: C{int}
- at var PING_DELAY_NEXT: unknown
+ at var PING_DELAY_NEXT: not used
@type ADJUST_UP: C{float}
- at var ADJUST_UP: unknown
+ at var ADJUST_UP: fraction to adjust up the upload rate by
@type ADJUST_DOWN: C{float}
- at var ADJUST_DOWN: unknown
+ at var ADJUST_DOWN: fraction to adjust down the upload rate by
@type UP_DELAY_FIRST: C{int}
- at var UP_DELAY_FIRST: unknown
+ at var UP_DELAY_FIRST: number of cycles after an adjust down before adjusting
+ up the upload rate
@type UP_DELAY_NEXT: C{int}
- at var UP_DELAY_NEXT: unknown
+ at var UP_DELAY_NEXT: number of cycles after an adjust up before adjusting
+ up the upload rate again
@type SLOTS_STARTING: C{int}
- at var SLOTS_STARTING: unknown
+ at var SLOTS_STARTING: the starting number of upload slots to use
@type SLOTS_FACTOR: C{float}
- at var SLOTS_FACTOR: unknown
+ at var SLOTS_FACTOR: factor to use in calculating the number of upload slots
"""
@@ -76,8 +82,8 @@
@ivar sched: the method to call to schedule a task with the server
@type last: L{BT1.Connecter.Connection}
@ivar last: the last connection on the circular queue of connections to send on
- @type unitsize: unknown
- @ivar unitsize: unknown
+ @type unitsize: C{int}
+ @ivar unitsize: when limiting upload rate, how many bytes to send at a time
@type slotsfunc: C{method}
@ivar slotsfunc: the method to call to set the number of connections limits
@type measure: L{CurrentRateMeasure.Measure}
@@ -89,11 +95,12 @@
@type slots: C{int}
@ivar slots: the number of upload slots to use (for automatic adjustment)
@type autoadjustup: C{int}
- @ivar autoadjustup: unknown
- @type pings: unknown
- @ivar pings: unknown
- @type lasttime: unknown
- @ivar lasttime: unknown
+ @ivar autoadjustup: number of cycles remaining before adjusting up the
+ upload rate
+ @type pings: C{list} of C{boolean}
+ @ivar pings: the latest ping results, True if the threshold was exceeded
+ @type lasttime: C{float}
+ @ivar lasttime: the last time data was sent
@type bytes_sent: C{int}
@ivar bytes_sent: the number of bytes sent on the most recent attempt
@@ -104,8 +111,8 @@
@type sched: C{method}
@param sched: the method to call to schedule a task with the server
- @type unitsize: unknown
- @param unitsize: unknown
+ @type unitsize: C{int}
+ @param unitsize: when limiting upload rate, how many bytes to send at a time
@type slotsfunc: C{method}
@param slotsfunc: the method to call to set the number of connections limits
(optional, defaults to not setting anything)
@@ -173,7 +180,7 @@
"""Loop through the circular queue of upload connections, trying to send on each.
@type check_time: C{boolean}
- @param check_time: unknown
+ @param check_time: whether to make sure the bytes sent is not negative
"""
Modified: debtorrent/trunk/DebTorrent/RawServer.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/RawServer.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/RawServer.py (original)
+++ debtorrent/trunk/DebTorrent/RawServer.py Mon Jul 30 02:26:41 2007
@@ -61,16 +61,18 @@
Mostly just manages the tasks, any socket related duties are passed on to
the L{SocketHandler.SocketHandler} instance.
- @type timeout_check_interval: unknown
- @ivar timeout_check_interval: unknown
- @type timeout: unknown
- @ivar timeout: unknown
- @type servers: unknown
- @ivar servers: unknown
- @type single_sockets: unknown
- @ivar single_sockets: unknown
- @type dead_from_write: unknown
- @ivar dead_from_write: unknown
+ @type timeout_check_interval: C{float}
+ @ivar timeout_check_interval: seconds to wait between checking if any
+ connections have timed out
+ @type timeout: C{float}
+ @ivar timeout: seconds to wait between closing sockets on which
+ nothing has been received on
+ @type servers: C{dictionary}
+ @ivar servers: not used
+ @type single_sockets: C{dictionary}
+ @ivar single_sockets: not used
+ @type dead_from_write: C{list}
+ @ivar dead_from_write: not used
@type doneflag: C{threading.Event}
@ivar doneflag: flag to indicate the program is to be shutdown
@type noisy: C{boolean}
@@ -79,16 +81,17 @@
@ivar failfunc: method to call to report failures
@type errorfunc: C{method}
@ivar errorfunc: method to call to report exceptions
- @type exccount: unknown
- @ivar exccount: unknown
- @type funcs: unknown
- @ivar funcs: unknown
- @type externally_added: unknown
- @ivar externally_added: unknown
- @type finished: unknown
- @ivar finished: unknown
- @type tasks_to_kill: unknown
- @ivar tasks_to_kill: unknown
+ @type exccount: C{int}
+ @ivar exccount: number of exceptions that have occurred
+ @type funcs: C{list} of (C{float}, C{method}, unknown)
+ @ivar funcs: the list of future methods to invoke, the time to invoke at,
+ the method, and the ID to use to identify the method
+ @type externally_added: C{list} of (C{float}, C{method}, unknown)
+ @ivar externally_added: externally queued tasks to add to L{funcs}
+ @type finished: C{threading.Event}
+ @ivar finished: whether the server is done listening
+ @type tasks_to_kill: C{list}
+ @ivar tasks_to_kill: the IDs of tasks to remove from L{funcs}
@type excflag: C{threading.Event}
@ivar excflag: the flag to use to indicate an exception has occurred
@type sockethandler: L{SocketHandler.SocketHandler}
Modified: debtorrent/trunk/DebTorrent/ServerPortHandler.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/ServerPortHandler.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/ServerPortHandler.py (original)
+++ debtorrent/trunk/DebTorrent/ServerPortHandler.py Mon Jul 30 02:26:41 2007
@@ -199,7 +199,7 @@
@type multihandler: L{MultiHandler}
@ivar multihandler: the collection of all torrent Servers
- @type connection: unknown
+ @type connection: L{SocketServer.SingleSocket}
@ivar connection: the connection to handle
@type closed: C{boolean}
@ivar closed: whether the connection has been closed
@@ -233,7 +233,7 @@
@type multihandler: L{MultiHandler}
@param multihandler: the collection of all torrent Servers
- @type connection: unknown
+ @type connection: L{SocketServer.SingleSocket}
@param connection: the new connection to handle
"""
@@ -491,7 +491,7 @@
def connection_flushed(self, ss):
"""Do nothing.
- @type ss: unknown
+ @type ss: L{SocketServer.SingleSocket}
@param ss: the connection that was flushed
"""
@@ -501,7 +501,7 @@
def connection_lost(self, ss):
"""Close the lost connection.
- @type ss: unknown
+ @type ss: L{SocketServer.SingleSocket}
@param ss: the connection that was lost
"""
@@ -521,9 +521,9 @@
@ivar singlerawservers: keys are torrent infohash strings, values are
individual L{SingleRawServer} for the torrents
@type connections: C{dictionary}
- @ivar connections: unknown
+ @ivar connections: not used
@type taskqueues: C{dictionary}
- @ivar taskqueues: unknown
+ @ivar taskqueues: not used
"""
Modified: debtorrent/trunk/DebTorrent/download_bt1.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/download_bt1.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/download_bt1.py (original)
+++ debtorrent/trunk/DebTorrent/download_bt1.py Mon Jul 30 02:26:41 2007
@@ -499,7 +499,7 @@
@type super_seeding_active: C{boolean}
@ivar super_seeding_active: whether the download is in super-seed mode
@type filedatflag: C{threading.Event}
- @ivar filedatflag: unknown
+ @ivar filedatflag: not used
@type superseedflag: C{threading.Event}
@ivar superseedflag: indicates the upload is in super-seed mode
@type whenpaused: C{float}
@@ -889,7 +889,7 @@
def _make_upload(self, connection, ratelimiter, totalup):
"""Create a new Upload instance
- @type connection: unknown
+ @type connection: L{BT1.Connecter.Connection}
@param connection: the connection to upload on
@type ratelimiter: L{BT1.RateLimiter.RateLimiter}
@param ratelimiter: the RateLimiter instance to use
@@ -908,7 +908,7 @@
def _kick_peer(self, connection):
"""Disconnect a peer.
- @type connection: unknown
+ @type connection: L{BT1.Connecter.Connection}
@param connection: the connection of the peer to disconnect
"""
@@ -916,7 +916,7 @@
def k(connection = connection):
"""Close a connection.
- @type connection: unknown
+ @type connection: L{Connecter.Connection}
@param connection: the connection of the peer to disconnect
(optional, defaults to the _kick_peer connection)
Modified: debtorrent/trunk/DebTorrent/launchmanycore.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/launchmanycore.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/launchmanycore.py (original)
+++ debtorrent/trunk/DebTorrent/launchmanycore.py Mon Jul 30 02:26:41 2007
@@ -73,15 +73,16 @@
@type doneflag: C{threading.Event}
@ivar doneflag: the flag that indicates when the torrent is to be shutdown
@type waiting: C{boolean}
- @ivar waiting: unknown
+ @ivar waiting: whether the download is waiting for the hash check to
+ complete before starting
@type checking: C{boolean}
- @ivar checking: unknown
+ @ivar checking: whether the hash check is in progress
@type working: C{boolean}
- @ivar working: unknown
+ @ivar working: whether the download is under way
@type seed: C{boolean}
- @ivar seed: unknown
+ @ivar seed: whether this peer is a seed
@type closed: C{boolean}
- @ivar closed: unknown
+ @ivar closed: whether the download has been shutdown
@type status_msg: C{string}
@ivar status_msg: the current activity the torrent is engaged in
@type status_err: C{list} of C{string}
@@ -398,7 +399,7 @@
C{long}, C{float}, C{string})
Which are the name, info hash, current status, progress report,
- number of peers, number of seeds, unknown, number of distributed copies,
+ number of peers, number of seeds, seed message, number of distributed copies,
upload rate, download rate, amount uploaded, amount downloaded,
total length, time remaining, and latest error message.
Modified: debtorrent/trunk/DebTorrent/selectpoll.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/selectpoll.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/selectpoll.py (original)
+++ debtorrent/trunk/DebTorrent/selectpoll.py Mon Jul 30 02:26:41 2007
@@ -82,8 +82,8 @@
def poll(self, timeout = None):
"""Poll the registered sockets for events.
- @type timeout: unknown
- @param timeout: unknown
+ @type timeout: C{int}
+ @param timeout: number of seconds to wait before timing out and returning
@rtype: C{list} of (C{int}, C{int})
@return: the socket file descriptors and event types that have occurred on them
Modified: debtorrent/trunk/test.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/test.py?rev=191&op=diff
==============================================================================
--- debtorrent/trunk/test.py (original)
+++ debtorrent/trunk/test.py Mon Jul 30 02:26:41 2007
@@ -298,7 +298,7 @@
@type func: C{method}
@param func: the function to call in the child
- @type args: unknown
+ @type args: C{list} of C{string}
@param args: the argument to pass to the function
@type work_dir: C{string}
@param work_dir: the directory to change to to execute the child process in
More information about the Debtorrent-commits
mailing list