Package Tribler :: Package Core :: Module RequestPolicy :: Class CommonRequestPolicy

Class CommonRequestPolicy

AbstractRequestPolicy --+
                        |
                       CommonRequestPolicy
Known Subclasses:

A base class implementing some methods that can be used as building blocks for RequestPolicies.
Instance Methods
 
__init__(self, session)
Constructor
 
isFriend(self, permid)
Returns: Whether or not the specified permid is a friend.
 
isSuperPeer(self, permid)
Returns: Whether of not the specified permid is a superpeer.
 
isCrawler(self, permid)
Returns: Whether of not the specified permid is a superpeer.
 
benign_random_peer(self, permid)
Returns: Whether or not the specified permid has exceeded his quota of remote query messages.
 
get_peer_nqueries(self, permid)
Returns: The number of remote query messages already received from this peer.

Inherited from AbstractRequestPolicy: allowed

Method Details

__init__(self, session)
(Constructor)

 
Constructor
Overrides: AbstractRequestPolicy.__init__

isFriend(self, permid)

 
Parameters:
  • permid - The permid of the sending peer.
Returns:
Whether or not the specified permid is a friend.

isSuperPeer(self, permid)

 
Parameters:
  • permid - The permid of the sending peer.
Returns:
Whether of not the specified permid is a superpeer.

isCrawler(self, permid)

 
Parameters:
  • permid - The permid of the sending peer.
Returns:
Whether of not the specified permid is a superpeer.

benign_random_peer(self, permid)

 
Parameters:
  • permid - The permid of the sending peer.
Returns:
Whether or not the specified permid has exceeded his quota of remote query messages.

get_peer_nqueries(self, permid)

 
Parameters:
  • permid - The permid of the sending peer.
Returns:
The number of remote query messages already received from this peer.