Package Anomos :: Module NetworkModel :: Class SimPeer
[hide private]
[frames] | no frames]

Class SimPeer

source code

Container for some information tracker needs to know about each peer, also node in Graph model of network topology used for Tracking Code generation.

Instance Methods [hide private]
 
__init__(self, name, pubkey, ip, port, sid) source code
 
needsUpdate(self) source code
 
cmpCertificate(self, peercert) source code
 
numNeeded(self) source code
 
update(self, params) source code
 
addNeighbor(self, peerid, nid, ip, port)
Assign Neighbor ID to peer
source code
 
rmNeighbor(self, peerid)
Remove connection to neighbor
source code
 
failed(self, nid) source code
 
getSessionID(self) source code
set of ints
getAvailableNIDs(self)
Returns: set object containing NIDs in range 0 -> 254 which are not in use
source code
 
getNID(self, peerid, default=None)
Return the relative ID associated with peerid return default if the vertices aren't connected
source code
 
getNbrs(self) source code
 
numTorrents(self) source code
 
isSharing(self, infohash) source code
 
isSeeding(self, infohash) source code
 
__str__(self) source code
Method Details [hide private]

__init__(self, name, pubkey, ip, port, sid)
(Constructor)

source code 
Parameters:
  • name (string) - Peer ID to be assigned to this SimPeer
  • pubkey (Anomos.Crypto.RSAPubKey) - RSA Public Key to use when encrypting to this peer

addNeighbor(self, peerid, nid, ip, port)

source code 

Assign Neighbor ID to peer

Parameters:
  • peerid (string)
  • nid (int)

rmNeighbor(self, peerid)

source code 

Remove connection to neighbor

Parameters:
  • peerid (string)

getAvailableNIDs(self)

source code 
Returns: set of ints
set object containing NIDs in range 0 -> 254 which are not in use