Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
con::Peer Class Reference

#include <impl.h>

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

Classes

struct  rttstats
 

Public Member Functions

virtual ~Peer ()
 
void Drop ()
 
virtual void PutReliableSendCommand (ConnectionCommandPtr &c, unsigned int max_packet_size)
 
bool isPendingDeletion () const
 
void ResetTimeout ()
 
bool isHalfOpen () const
 
void SetFullyOpen ()
 
virtual bool isTimedOut (float timeout, std::string &reason)
 
virtual u16 getNextSplitSequenceNumber (u8 channel)
 
virtual void setNextSplitSequenceNumber (u8 channel, u16 seqnum)
 
virtual SharedBuffer< u8 > addSplitPacket (u8 channel, BufferedPacketPtr &toadd, bool reliable)
 
virtual bool Ping (float dtime, SharedBuffer< u8 > &data)
 
virtual float getStat (rtt_stat_type type) const
 
- Public Member Functions inherited from con::IPeer
virtual const AddressgetAddress () const =0
 

Public Attributes

unsigned int m_increment_packets_remaining = 0
 
- Public Attributes inherited from con::IPeer
const session_t id
 

Protected Member Functions

 Peer (session_t id, const Address &address, Connection *connection)
 
virtual void reportRTT (float rtt)
 
void RTTStatistics (float rtt, const std::string &profiler_id="", unsigned int num_samples=1000)
 
bool IncUseCount ()
 
void DecUseCount ()
 
- Protected Member Functions inherited from con::IPeer
 IPeer (session_t id)
 
 ~IPeer ()
 

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
 
bool m_half_open = true
 
unsigned int m_usage = 0
 
float m_timeout_counter = 0.0f
 
u64 m_last_timeout_check
 

Friends

class PeerHelper
 

Constructor & Destructor Documentation

◆ ~Peer()

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

◆ Peer()

con::Peer::Peer ( session_t id,
const Address & address,
Connection * connection )
inlineprotected

Member Function Documentation

◆ addSplitPacket()

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

Reimplemented in con::UDPPeer.

References FATAL_ERROR.

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(), and con::PeerHelper::operator=().

+ 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:

◆ 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::operator=().

+ Here is the caller graph for this function:

◆ isHalfOpen()

bool con::Peer::isHalfOpen ( ) const
inline

References m_exclusive_access_mutex, and m_half_open.

Referenced by con::Connection::getActiveCount(), con::UDPPeer::Ping(), con::ConnectionReceiveThread::receive(), and con::ConnectionSendThread::runTimeouts().

+ Here is the caller graph for this function:

◆ isPendingDeletion()

bool con::Peer::isPendingDeletion ( ) const
inline

References m_exclusive_access_mutex, and m_pending_deletion.

Referenced by con::Connection::getActiveCount(), and con::Connection::lookupPeer().

+ Here is the caller graph for this function:

◆ isTimedOut()

bool con::Peer::isTimedOut ( float timeout,
std::string & reason )
virtual

Reimplemented in con::UDPPeer.

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

Referenced by con::UDPPeer::isTimedOut(), and 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 ( ConnectionCommandPtr & 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:

◆ SetFullyOpen()

void con::Peer::SetFullyOpen ( )
inline

References m_exclusive_access_mutex, and m_half_open.

Referenced by con::Connection::createServerPeer(), and con::ConnectionReceiveThread::receive().

+ 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 Symbol Documentation

◆ PeerHelper

friend class PeerHelper
friend

Member Data Documentation

◆ address

◆ m_connection

◆ m_exclusive_access_mutex

◆ m_half_open

bool con::Peer::m_half_open = true
private

Referenced by isHalfOpen(), and SetFullyOpen().

◆ 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: