libktorrent  2.2.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
net::SocketMonitor Class Reference

#include <socketmonitor.h>

Public Types

enum  GroupType { UPLOAD_GROUP, DOWNLOAD_GROUP }
 
typedef std::list< TrafficShapedSocket * >::iterator Itr
 

Public Member Functions

void add (TrafficShapedSocket *sock)
 Add a new socket, will start the threads if necessary.
 
Itr begin ()
 Get the begin of the list of sockets.
 
Itr end ()
 Get the end of the list of sockets.
 
void lock ()
 lock the monitor
 
Uint32 newGroup (GroupType type, Uint32 limit, Uint32 assured_rate)
 
void remove (TrafficShapedSocket *sock)
 Remove a socket, will stop threads if no more sockets are left.
 
void removeGroup (GroupType type, Uint32 gid)
 
void setGroupAssuredRate (GroupType type, Uint32 gid, Uint32 as)
 
void setGroupLimit (GroupType type, Uint32 gid, Uint32 limit)
 
void shutdown ()
 
void signalPacketReady ()
 Tell upload thread a packet is ready.
 
void unlock ()
 unlock the monitor
 

Static Public Member Functions

static Uint32 getDownloadCap ()
 
static Uint32 getUploadCap ()
 
static SocketMonitorinstance ()
 
static void setDownloadCap (Uint32 bytes_per_sec)
 
static void setSleepTime (Uint32 sleep_time)
 
static void setUploadCap (Uint32 bytes_per_sec)
 

Detailed Description

Author
Joris Guisson joris.nosp@m..gui.nosp@m.sson@.nosp@m.gmai.nosp@m.l.com

Monitors all sockets for upload and download traffic. It uses two threads to do this.

Definition at line 44 of file socketmonitor.h.

Member Function Documentation

◆ newGroup()

Uint32 net::SocketMonitor::newGroup ( GroupType  type,
Uint32  limit,
Uint32  assured_rate 
)

Creata a new upload or download group

Parameters
typeWhether it is an upload or download group
limitLimit of group in bytes/s
assured_rateThe assured rate in bytes/s
Returns
The group ID

◆ removeGroup()

void net::SocketMonitor::removeGroup ( GroupType  type,
Uint32  gid 
)

Remove a group

Parameters
typeThe group type
gidThe group id

◆ setGroupAssuredRate()

void net::SocketMonitor::setGroupAssuredRate ( GroupType  type,
Uint32  gid,
Uint32  as 
)

Change the group assured rate

Parameters
typeThe group type
gidThe group id
limitThe limit

◆ setGroupLimit()

void net::SocketMonitor::setGroupLimit ( GroupType  type,
Uint32  gid,
Uint32  limit 
)

Change the group limit

Parameters
typeThe group type
gidThe group id
limitThe limit

◆ shutdown()

void net::SocketMonitor::shutdown ( )

Shutdown the socketmonitor and all the networking threads.


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