Package DebTorrent :: Module ServerPortHandler :: Class MultiHandler
[hide private]
[frames] | no frames]

Class MultiHandler

source code

Collection of Servers/Port Handlers for multiple torrents.

Instance Methods [hide private]
 
__init__(self, rawserver, doneflag, config)
Initialize the instance.
source code
SingleRawServer
newRawServer(self, info_hash, doneflag, protocol='DebTorrent/0.1')
Create a new Server for the torrent.
source code
 
shutdown_torrent(self, info_hash)
Shutdown a single torrent's Server.
source code
boolean
listen_forever(self)
Call the master server's listen loop.
source code
 
external_connection_made(self, ss)
Handle a new incoming connection from the master Server.
source code
Instance Variables [hide private]
dictionary config
the configuration parameters
dictionary connections
not used
threading.Event masterdoneflag
the flag to indicate stopping to the master Server
RawServer.RawServer rawserver
the master Server
dictionary singlerawservers
keys are torrent infohash strings, values are individual SingleRawServer for the torrents
dictionary taskqueues
not used
Method Details [hide private]

__init__(self, rawserver, doneflag, config)
(Constructor)

source code 
Initialize the instance.
Parameters:
  • rawserver (RawServer.RawServer) - the master Server
  • doneflag (threading.Event) - the flag to indicate stopping to the master Server
  • config (dictionary) - the configuration parameters

newRawServer(self, info_hash, doneflag, protocol='DebTorrent/0.1')

source code 
Create a new Server for the torrent.
Parameters:
  • info_hash (string) - the torrent's infohash
  • doneflag (threading.Event) - the flag to indicate stopping to the new Server
  • protocol (string) - the name to use for the communication protocol (optional, defaults to DebTorrent.protocol_name)
Returns: SingleRawServer
the new Server that was created

shutdown_torrent(self, info_hash)

source code 
Shutdown a single torrent's Server.
Parameters:
  • info_hash (string) - the torrent's infohash

listen_forever(self)

source code 
Call the master server's listen loop.
Returns: boolean
whether the server should be restarted

external_connection_made(self, ss)

source code 
Handle a new incoming connection from the master Server.
Parameters:
  • ss (unknown) - unknown