libktorrent  2.2.0
Classes | Public Member Functions | Protected Member Functions | List of all members
bt::ConnectionLimit Class Reference

#include <connectionlimit.h>

Classes

class  Token
 

Public Member Functions

Token::Ptr acquire (const SHA1Hash &hash)
 
void setLimits (bt::Uint32 global_limit, bt::Uint32 torrent_limit)
 
bt::Uint32 totalConnections () const
 Get the total number of connections currently in use.
 

Protected Member Functions

void release (const Token &token)
 

Detailed Description

Maintains the connection limit. It uses a Token for that.

Definition at line 35 of file connectionlimit.h.

Member Function Documentation

◆ acquire()

Token::Ptr bt::ConnectionLimit::acquire ( const SHA1Hash hash)

Request a token for a given torrent

Parameters
hashInfo hash of the torrent
Returns
ConnectionLimit::Token::Ptr a valid token if a connection can be opened, a 0 pointer if not

◆ release()

void bt::ConnectionLimit::release ( const Token token)
protected

Release one Token. Will be done by destructor of Token.

Parameters
tokenThe Token

◆ setLimits()

void bt::ConnectionLimit::setLimits ( bt::Uint32  global_limit,
bt::Uint32  torrent_limit 
)

Set the connection limits

Parameters
global_limitGlobal limit
torrent_limitPer torrent limit

The documentation for this class was generated from the following file: