KanoopTorrentQt 0.1.0
Qt6 wrapper library for libtorrent-rasterbar
Loading...
Searching...
No Matches
PeerInfo Class Reference

Snapshot of a connected peer's state. More...

#include <peerinfo.h>

Public Types

enum  Flag {
  NoFlags = 0x0000 , Interesting = 0x0001 , Choked = 0x0002 , RemoteChoked = 0x0004 ,
  Seed = 0x0008 , Encrypted = 0x0010 , Incoming = 0x0020 , Snubbed = 0x0040 ,
  UploadOnly = 0x0080
}
 Capability and state flags for a peer connection. More...
 

Public Member Functions

QHostAddress address () const
 Peer's IP address.
 
void setAddress (const QHostAddress &value)
 
quint16 port () const
 Peer's TCP port.
 
void setPort (quint16 value)
 
QString client () const
 Peer's client identification string (e.g.
 
void setClient (const QString &value)
 
qint64 downloadRate () const
 Current download rate from this peer in bytes/sec.
 
void setDownloadRate (qint64 value)
 
qint64 uploadRate () const
 Current upload rate to this peer in bytes/sec.
 
void setUploadRate (qint64 value)
 
qint64 totalDownload () const
 Total bytes downloaded from this peer.
 
void setTotalDownload (qint64 value)
 
qint64 totalUpload () const
 Total bytes uploaded to this peer.
 
void setTotalUpload (qint64 value)
 
double progress () const
 Peer's download progress as a ratio from 0.0 to 1.0.
 
void setProgress (double value)
 
Flags flags () const
 Capability and state flags for this connection.
 
void setFlags (Flags value)
 

Detailed Description

Snapshot of a connected peer's state.

PeerInfo is a lightweight value class populated by Torrent::peers(). Each instance captures a point-in-time view of one peer connection including transfer rates, identification, and capability flags.

Definition at line 15 of file peerinfo.h.

Member Enumeration Documentation

◆ Flag

Capability and state flags for a peer connection.

These flags can be combined with bitwise OR.

Enumerator
Interesting 

We are interested in pieces this peer has.

Choked 

We are choking this peer (not uploading to it).

RemoteChoked 

This peer is choking us (not uploading to us).

Seed 

Peer has the complete torrent.

Encrypted 

Connection is encrypted (RC4 or AES).

Incoming 

Peer initiated the connection.

Snubbed 

Peer has not sent data for a long time.

UploadOnly 

Peer is in upload-only mode (e.g. super-seeding).

Definition at line 23 of file peerinfo.h.

Member Function Documentation

◆ address()

QHostAddress PeerInfo::address ( ) const
inline

Peer's IP address.

Definition at line 41 of file peerinfo.h.

◆ client()

QString PeerInfo::client ( ) const
inline

Peer's client identification string (e.g.

"qBittorrent 4.6.2").

Derived from the peer's extension handshake or peer ID encoding.

Definition at line 53 of file peerinfo.h.

◆ downloadRate()

qint64 PeerInfo::downloadRate ( ) const
inline

Current download rate from this peer in bytes/sec.

Definition at line 59 of file peerinfo.h.

◆ flags()

Flags PeerInfo::flags ( ) const
inline

Capability and state flags for this connection.

Definition at line 83 of file peerinfo.h.

◆ port()

quint16 PeerInfo::port ( ) const
inline

Peer's TCP port.

Definition at line 45 of file peerinfo.h.

◆ progress()

double PeerInfo::progress ( ) const
inline

Peer's download progress as a ratio from 0.0 to 1.0.

Definition at line 77 of file peerinfo.h.

◆ setAddress()

void PeerInfo::setAddress ( const QHostAddress &  value)
inline

Definition at line 42 of file peerinfo.h.

◆ setClient()

void PeerInfo::setClient ( const QString &  value)
inline

Definition at line 54 of file peerinfo.h.

◆ setDownloadRate()

void PeerInfo::setDownloadRate ( qint64  value)
inline

Definition at line 60 of file peerinfo.h.

◆ setFlags()

void PeerInfo::setFlags ( Flags  value)
inline

Definition at line 84 of file peerinfo.h.

◆ setPort()

void PeerInfo::setPort ( quint16  value)
inline

Definition at line 46 of file peerinfo.h.

◆ setProgress()

void PeerInfo::setProgress ( double  value)
inline

Definition at line 78 of file peerinfo.h.

◆ setTotalDownload()

void PeerInfo::setTotalDownload ( qint64  value)
inline

Definition at line 68 of file peerinfo.h.

◆ setTotalUpload()

void PeerInfo::setTotalUpload ( qint64  value)
inline

Definition at line 72 of file peerinfo.h.

◆ setUploadRate()

void PeerInfo::setUploadRate ( qint64  value)
inline

Definition at line 64 of file peerinfo.h.

◆ totalDownload()

qint64 PeerInfo::totalDownload ( ) const
inline

Total bytes downloaded from this peer.

Definition at line 67 of file peerinfo.h.

◆ totalUpload()

qint64 PeerInfo::totalUpload ( ) const
inline

Total bytes uploaded to this peer.

Definition at line 71 of file peerinfo.h.

◆ uploadRate()

qint64 PeerInfo::uploadRate ( ) const
inline

Current upload rate to this peer in bytes/sec.

Definition at line 63 of file peerinfo.h.


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