Package DebTorrent :: Package BT1 :: Module Uploader :: Class Upload
[hide private]
[frames] | no frames]

Class Upload

source code

Manage uploading to a single peer.

Instance Methods [hide private]
 
__init__(self, connection, ratelimiter, totalup, choker, storage, picker, config)
Initialize the instance and send the initial bitfield.
source code
 
got_not_interested(self)
Process a received not interested message.
source code
 
got_interested(self)
Process a received interested message.
source code
(int, int, string)
get_upload_chunk(self)
Get a chunk to upload to the peer.
source code
 
got_request(self, index, begin, length)
Add a received request for a chunk to the buffer.
source code
 
got_cancel(self, index, begin, length)
Cancel a request for a chunk.
source code
 
choke(self)
Start choking the connection.
source code
 
choke_sent(self)
Remove all requests after a choke is sent.
source code
 
unchoke(self)
Unchoke the connection.
source code
 
disconnected(self)
Clean up for disconnection from the peer.
source code
boolean
is_choked(self)
Check whether we are choking the connection.
source code
boolean
is_interested(self)
Check whether the peer is interested in downloading.
source code
boolean
has_queries(self)
Check whether we have pending requests for chunks from the peer.
source code
float
get_rate(self)
Get the current upload rate to the peer.
source code
Instance Variables [hide private]
list of (int, int, int) buffer
the pending requests for the peer, the piece index, offset within the piece, and chunk length requested
boolean choked
whether we are choking the connection
Choker.Choker choker
the Choker instance to use
boolean cleared
whether requests are allowed to be appended to the buffer
dictionary config
the configration information
Connecter.Connection connection
the connection to the peer
boolean interested
whether the peer is interested
int max_slice_length
maximum length chunk to send to peers
DebTorrent.CurrentRateMeasure.Measure measure
for measuring the upload rate to the peer
BT1.PiecePicker.PiecePicker picker
the PiecePicker instance
DebTorrent.piecebuffer.SingleBuffer piecebuf
the buffer containing the entire piece currently being downloaded by the peer
int piecedl
the current piece being downloaded by the peer
RateLimiter.RateLimiter ratelimiter
the RateLimiter instance to use
list of int seed_have_list
the list of pieces the peer is allowed to request in super-seed mode
int skipped_count
the number of pieces the peer has refused to request from us in super-seed mode
BT1.StorageWrapper.StorageWrapper storage
the StorageWrapper instance
boolean super_seeding
whether we are in super-seed mode
Debtorrent.CurrentRateMeasure.Measure totalup
the Measure instance to use
boolean was_ever_interested
whether the peer has ever been interested
Method Details [hide private]

__init__(self, connection, ratelimiter, totalup, choker, storage, picker, config)
(Constructor)

source code 
Initialize the instance and send the initial bitfield.
Parameters:

get_upload_chunk(self)

source code 
Get a chunk to upload to the peer.
Returns: (int, int, string)
the piece index, offset within the piece, and the chunk

got_request(self, index, begin, length)

source code 
Add a received request for a chunk to the buffer.
Parameters:
  • index (int) - the piece index
  • begin (int) - the offset within the piece
  • length (int) - the amount of data to return

got_cancel(self, index, begin, length)

source code 
Cancel a request for a chunk.
Parameters:
  • index (int) - the piece index
  • begin (int) - the offset within the piece
  • length (int) - the amount of data to return

is_choked(self)

source code 
Check whether we are choking the connection.
Returns: boolean
whether the connection is being choked

is_interested(self)

source code 
Check whether the peer is interested in downloading.
Returns: boolean
whether the connected peer is interested

has_queries(self)

source code 
Check whether we have pending requests for chunks from the peer.
Returns: boolean
whether there are requests pending

get_rate(self)

source code 
Get the current upload rate to the peer.
Returns: float
the current upload rate