Minetest  5.4.0
con::Peer Class Referenceabstract

#include <connection.h>

+ Inheritance diagram for con::Peer:
+ Collaboration diagram for con::Peer:

Classes

struct  rttstats
 

Public Member Functions

 Peer (Address address_, u16 id_, Connection *connection)
 
virtual ~Peer ()
 
void Drop ()
 
virtual void PutReliableSendCommand (ConnectionCommand &c, unsigned int max_packet_size)
 
virtual bool getAddress (MTProtocols type, Address &toset)=0
 
bool isPendingDeletion ()
 
void ResetTimeout ()
 
bool isTimedOut (float timeout)
 
virtual u16 getNextSplitSequenceNumber (u8 channel)
 
virtual void setNextSplitSequenceNumber (u8 channel, u16 seqnum)
 
virtual SharedBuffer< u8 > addSplitPacket (u8 channel, const BufferedPacket &toadd, bool reliable)
 
virtual bool Ping (float dtime, SharedBuffer< u8 > &data)
 
virtual float getStat (rtt_stat_type type) const
 

Public Attributes

u16 id
 
unsigned int m_increment_packets_remaining = 0
 

Protected Member Functions

virtual void reportRTT (float rtt)
 
void RTTStatistics (float rtt, const std::string &profiler_id="", unsigned int num_samples=1000)
 
bool IncUseCount ()
 
void DecUseCount ()
 

Protected Attributes

std::mutex m_exclusive_access_mutex
 
bool m_pending_deletion = false
 
Connectionm_connection
 
Address address
 
float m_ping_timer = 0.0f
 

Private Attributes

rttstats m_rtt
 
float m_last_rtt = -1.0f
 
unsigned int m_usage = 0
 
float m_timeout_counter = 0.0f
 
u64 m_last_timeout_check
 

Friends

class PeerHelper
 

Constructor & Destructor Documentation

◆ Peer()

con::Peer::Peer ( Address  address_,
u16  id_,
Connection connection 
)
inline

◆ ~Peer()

virtual con::Peer::~Peer ( )
inlinevirtual

Member Function Documentation

◆ addSplitPacket()

virtual SharedBuffer<u8> con::Peer::addSplitPacket ( u8  channel,
const BufferedPacket toadd,
bool  reliable 
)
inlinevirtual

Reimplemented in con::UDPPeer.

References errorstream.

Referenced by con::ConnectionReceiveThread::handlePacketType_Split().

+ Here is the caller graph for this function:

◆ DecUseCount()

void con::Peer::DecUseCount ( )
protected

References m_exclusive_access_mutex, m_pending_deletion, m_usage, and sanity_check.

Referenced by con::PeerHelper::~PeerHelper().

+ Here is the caller graph for this function:

◆ Drop()

void con::Peer::Drop ( )

References g_profiler, con::Connection::getDesc(), m_connection, m_exclusive_access_mutex, m_pending_deletion, m_usage, PROFILE, Profiler::remove(), and SPT_AVG.

Referenced by con::Connection::deletePeer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAddress()

virtual bool con::Peer::getAddress ( MTProtocols  type,
Address toset 
)
pure virtual

◆ getNextSplitSequenceNumber()

virtual u16 con::Peer::getNextSplitSequenceNumber ( u8  channel)
inlinevirtual

Reimplemented in con::UDPPeer.

Referenced by con::ConnectionSendThread::send().

+ Here is the caller graph for this function:

◆ getStat()

virtual float con::Peer::getStat ( rtt_stat_type  type) const
inlinevirtual

◆ IncUseCount()

bool con::Peer::IncUseCount ( )
protected

References m_exclusive_access_mutex, m_pending_deletion, and m_usage.

Referenced by con::PeerHelper::PeerHelper(), and con::PeerHelper::operator=().

+ Here is the caller graph for this function:

◆ isPendingDeletion()

bool con::Peer::isPendingDeletion ( )
inline

References m_exclusive_access_mutex, and m_pending_deletion.

Referenced by con::Connection::lookupPeer().

+ Here is the caller graph for this function:

◆ isTimedOut()

bool con::Peer::isTimedOut ( float  timeout)

References con::CALC_DTIME(), porting::getTimeMs(), m_exclusive_access_mutex, m_last_timeout_check, and m_timeout_counter.

Referenced by con::ConnectionSendThread::runTimeouts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Ping()

virtual bool con::Peer::Ping ( float  dtime,
SharedBuffer< u8 > &  data 
)
inlinevirtual

Reimplemented in con::UDPPeer.

◆ PutReliableSendCommand()

virtual void con::Peer::PutReliableSendCommand ( ConnectionCommand c,
unsigned int  max_packet_size 
)
inlinevirtual

Reimplemented in con::UDPPeer.

Referenced by con::ConnectionSendThread::sendReliable(), and con::ConnectionSendThread::sendToAllReliable().

+ Here is the caller graph for this function:

◆ reportRTT()

virtual void con::Peer::reportRTT ( float  rtt)
inlineprotectedvirtual

Reimplemented in con::UDPPeer.

◆ ResetTimeout()

void con::Peer::ResetTimeout ( )
inline

References m_exclusive_access_mutex, and m_timeout_counter.

Referenced by con::ConnectionReceiveThread::receive().

+ Here is the caller graph for this function:

◆ RTTStatistics()

void con::Peer::RTTStatistics ( float  rtt,
const std::string &  profiler_id = "",
unsigned int  num_samples = 1000 
)
protected

References con::Peer::rttstats::avg_rtt, g_profiler, Profiler::graphAdd(), con::Peer::rttstats::jitter_avg, con::Peer::rttstats::jitter_max, con::Peer::rttstats::jitter_min, m_last_rtt, m_rtt, con::Peer::rttstats::max_rtt, and con::Peer::rttstats::min_rtt.

Referenced by con::UDPPeer::reportRTT().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setNextSplitSequenceNumber()

virtual void con::Peer::setNextSplitSequenceNumber ( u8  channel,
u16  seqnum 
)
inlinevirtual

Reimplemented in con::UDPPeer.

Referenced by con::ConnectionSendThread::send().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ PeerHelper

friend class PeerHelper
friend

Member Data Documentation

◆ address

◆ id

◆ m_connection

◆ m_exclusive_access_mutex

◆ m_increment_packets_remaining

unsigned int con::Peer::m_increment_packets_remaining = 0

◆ m_last_rtt

float con::Peer::m_last_rtt = -1.0f
private

Referenced by RTTStatistics().

◆ m_last_timeout_check

u64 con::Peer::m_last_timeout_check
private

Referenced by isTimedOut().

◆ m_pending_deletion

bool con::Peer::m_pending_deletion = false
protected

◆ m_ping_timer

float con::Peer::m_ping_timer = 0.0f
protected

Referenced by con::UDPPeer::Ping().

◆ m_rtt

rttstats con::Peer::m_rtt
private

Referenced by getStat(), and RTTStatistics().

◆ m_timeout_counter

float con::Peer::m_timeout_counter = 0.0f
private

Referenced by isTimedOut(), and ResetTimeout().

◆ m_usage

unsigned int con::Peer::m_usage = 0
private

Referenced by ~Peer(), DecUseCount(), Drop(), and IncUseCount().


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