• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kget

bt::PeerManager

bt::PeerManager Class Reference

#include <peermanager.h>

Inheritance diagram for bt::PeerManager:

Inheritance graph
[legend]

List of all members.


Detailed Description

Author:
Joris Guisson

Manages all the Peers

This class manages all Peer objects. It can also open connections to other peers.

Definition at line 65 of file peermanager.h.


Public Types

typedef QList< Peer * >
::const_iterator 
CItr

Public Slots

void peerSourceReady (PeerSource *ps)

Signals

void newPeer (Peer *p)
void peerKilled (Peer *p)
void stopped ()

Public Member Functions

void addPotentialPeer (const PotentialPeer &pp)
CItr beginPeerList () const
Uint32 clearDeadPeers ()
void closeAllConnections ()
bool connectedTo (const PeerID &peer_id)
void connectToPeers ()
CItr endPeerList () const
Peer * findPeer (PieceDownloader *pd)
Peer * findPeer (Uint32 peer_id)
const BitSet & getAvailableChunksBitSet () const
ChunkCounter & getChunkCounter ()
Uint32 getNumConnectedPeers () const
Uint32 getNumPending () const
Peer * getPeer (Uint32 index)
Torrent & getTorrent ()
bool isPexEnabled () const
bool isStarted () const
void killChokedPeers (Uint32 older_then)
void killSeeders ()
void killUninterested ()
void loadPeerList (const QString &file)
void newConnection (mse::StreamSocket *sock, const PeerID &peer_id, Uint32 support)
void peerAuthenticated (Authenticate *auth, bool ok)
 PeerManager (Torrent &tor)
void savePeerList (const QString &file)
void setGroupIDs (Uint32 up, Uint32 down)
void setPexEnabled (bool on)
void start ()
void stop ()
void update ()
virtual ~PeerManager ()

Static Public Member Functions

static Uint32 getMaxConnections ()
static Uint32 getMaxTotalConnections ()
static Uint32 getTotalConnections ()
static void setMaxConnections (Uint32 max)
static void setMaxTotalConnections (Uint32 max)

Member Typedef Documentation

typedef QList<Peer*>::const_iterator bt::PeerManager::CItr

Definition at line 206 of file peermanager.h.


Constructor & Destructor Documentation

bt::PeerManager::PeerManager ( Torrent &  tor  ) 

Constructor.

Parameters:
tor The Torrent

Definition at line 55 of file peermanager.cpp.

bt::PeerManager::~PeerManager (  )  [virtual]

Definition at line 66 of file peermanager.cpp.


Member Function Documentation

void bt::PeerManager::addPotentialPeer ( const PotentialPeer &  pp  ) 

Add a potential peer.

Parameters:
pp The PotentialPeer

Definition at line 148 of file peermanager.cpp.

CItr bt::PeerManager::beginPeerList (  )  const [inline]

Definition at line 208 of file peermanager.h.

Uint32 bt::PeerManager::clearDeadPeers (  ) 

Remove dead peers.

Returns:
The number of dead ones removed

Definition at line 410 of file peermanager.cpp.

void bt::PeerManager::closeAllConnections (  ) 

Close all Peer connections.

Definition at line 418 of file peermanager.cpp.

bool bt::PeerManager::connectedTo ( const PeerID &  peer_id  ) 

Are we connected to a Peer given it's PeerID ?

Definition at line 314 of file peermanager.cpp.

void bt::PeerManager::connectToPeers (  ) 

Try to connect to some peers.

Definition at line 343 of file peermanager.cpp.

CItr bt::PeerManager::endPeerList (  )  const [inline]

Definition at line 209 of file peermanager.h.

Peer * bt::PeerManager::findPeer ( PieceDownloader *  pd  ) 

Find a Peer based on it's PieceDownloader.

Parameters:
pd The PieceDownloader
Returns:
The matching Peer or 0 if none can be found

Definition at line 521 of file peermanager.cpp.

Peer * bt::PeerManager::findPeer ( Uint32  peer_id  ) 

Find a Peer based on it's ID.

Parameters:
peer_id The ID
Returns:
A Peer or 0, if nothing could be found

Definition at line 516 of file peermanager.cpp.

const BitSet& bt::PeerManager::getAvailableChunksBitSet (  )  const [inline]

Get a BitSet of all available chunks.

Definition at line 181 of file peermanager.h.

ChunkCounter& bt::PeerManager::getChunkCounter (  )  [inline]

Get the chunk counter.

Definition at line 184 of file peermanager.h.

static Uint32 bt::PeerManager::getMaxConnections (  )  [inline, static]

Definition at line 140 of file peermanager.h.

static Uint32 bt::PeerManager::getMaxTotalConnections (  )  [inline, static]

Definition at line 143 of file peermanager.h.

Uint32 bt::PeerManager::getNumConnectedPeers (  )  const [inline]

Definition at line 136 of file peermanager.h.

Uint32 bt::PeerManager::getNumPending (  )  const [inline]

Definition at line 137 of file peermanager.h.

Peer* bt::PeerManager::getPeer ( Uint32  index  )  [inline]

Get the i'th Peer.

Parameters:
index 
Returns:
Peer or 0 if out of range

Definition at line 94 of file peermanager.h.

Torrent& bt::PeerManager::getTorrent (  )  [inline]

Get the Torrent.

Definition at line 151 of file peermanager.h.

static Uint32 bt::PeerManager::getTotalConnections (  )  [inline, static]

Definition at line 145 of file peermanager.h.

bool bt::PeerManager::isPexEnabled (  )  const [inline]

Is PEX eanbled.

Definition at line 212 of file peermanager.h.

bool bt::PeerManager::isStarted (  )  const [inline]

Is the peer manager started.

Definition at line 148 of file peermanager.h.

void bt::PeerManager::killChokedPeers ( Uint32  older_then  ) 

Kill all peers who have been choked longer then older_then time.

Parameters:
older_then Time in milliseconds

Definition at line 113 of file peermanager.cpp.

void bt::PeerManager::killSeeders (  ) 

Kills all connections to seeders.

This is used when torrent download gets finished and we should drop all connections to seeders

Definition at line 197 of file peermanager.cpp.

void bt::PeerManager::killUninterested (  ) 

Kills all peers that are not interested for a long time.

This should be used when torrent is seeding ONLY.

Definition at line 209 of file peermanager.cpp.

void bt::PeerManager::loadPeerList ( const QString &  file  ) 

Load the peer list again and add them to the potential peers.

Definition at line 468 of file peermanager.cpp.

void bt::PeerManager::newConnection ( mse::StreamSocket *  sock,
const PeerID &  peer_id,
Uint32  support 
)

A new connection is ready for this PeerManager.

Parameters:
sock The socket
peer_id The Peer's ID
support What extensions the peer supports

Definition at line 240 of file peermanager.cpp.

void bt::PeerManager::newPeer ( Peer *  p  )  [signal]

void bt::PeerManager::peerAuthenticated ( Authenticate *  auth,
bool  ok 
)

A peer has authenticated.

Parameters:
auth The Authenticate object
ok Whether or not the attempt was succesfull

Definition at line 260 of file peermanager.cpp.

void bt::PeerManager::peerKilled ( Peer *  p  )  [signal]

void bt::PeerManager::peerSourceReady ( PeerSource *  ps  )  [slot]

A PeerSource, has new potential peers.

Parameters:
ps The PeerSource

Definition at line 547 of file peermanager.cpp.

void bt::PeerManager::savePeerList ( const QString &  file  ) 

Save the IP's and port numbers of all peers.

Definition at line 434 of file peermanager.cpp.

void bt::PeerManager::setGroupIDs ( Uint32  up,
Uint32  down 
)

Set the group IDs of each peer.

Definition at line 613 of file peermanager.cpp.

void bt::PeerManager::setMaxConnections ( Uint32  max  )  [static]

Definition at line 132 of file peermanager.cpp.

void bt::PeerManager::setMaxTotalConnections ( Uint32  max  )  [static]

Definition at line 137 of file peermanager.cpp.

void bt::PeerManager::setPexEnabled ( bool  on  ) 

Enable or disable PEX.

Definition at line 594 of file peermanager.cpp.

void bt::PeerManager::start (  ) 

Start listening to incoming requests.

Definition at line 499 of file peermanager.cpp.

void bt::PeerManager::stop (  ) 

Stop listening to incoming requests.

Definition at line 506 of file peermanager.cpp.

void bt::PeerManager::stopped (  )  [signal]

void bt::PeerManager::update (  ) 

Check for new connections, update down and upload speed of each Peer.

Initiate new connections.

Definition at line 80 of file peermanager.cpp.


The documentation for this class was generated from the following files:
  • peermanager.h
  • peermanager.cpp

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal