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

#include <internal.h>

+ Collaboration diagram for con::Channel:

Public Member Functions

u16 readNextIncomingSeqNum ()
 
u16 incNextIncomingSeqNum ()
 
u16 getOutgoingSequenceNumber (bool &successful)
 
u16 readOutgoingSequenceNumber ()
 
bool putBackSequenceNumber (u16)
 
u16 readNextSplitSeqNum ()
 
void setNextSplitSeqNum (u16 seqnum)
 
 Channel ()=default
 
 ~Channel ()=default
 
void UpdatePacketLossCounter (unsigned int count)
 
void UpdatePacketTooLateCounter ()
 
void UpdateBytesSent (unsigned int bytes, unsigned int packages=1)
 
void UpdateBytesLost (unsigned int bytes)
 
void UpdateBytesReceived (unsigned int bytes)
 
void UpdateTimers (float dtime)
 
float getCurrentDownloadRateKB ()
 
float getMaxDownloadRateKB ()
 
float getCurrentLossRateKB ()
 
float getMaxLossRateKB ()
 
float getCurrentIncomingRateKB ()
 
float getMaxIncomingRateKB ()
 
float getAvgDownloadRateKB ()
 
float getAvgLossRateKB ()
 
float getAvgIncomingRateKB ()
 
u16 getWindowSize () const
 
void setWindowSize (long size)
 

Public Attributes

ReliablePacketBuffer incoming_reliables
 
ReliablePacketBuffer outgoing_reliables_sent
 
std::queue< BufferedPacketPtrqueued_reliables
 
std::deque< ConnectionCommandPtrqueued_commands
 
IncomingSplitBuffer incoming_splits
 

Private Attributes

std::mutex m_internal_mutex
 
u16 m_window_size = MIN_RELIABLE_WINDOW_SIZE
 
u16 next_incoming_seqnum = SEQNUM_INITIAL
 
u16 next_outgoing_seqnum = SEQNUM_INITIAL
 
u16 next_outgoing_split_seqnum = SEQNUM_INITIAL
 
unsigned int current_packet_loss = 0
 
unsigned int current_packet_too_late = 0
 
unsigned int current_packet_successful = 0
 
float packet_loss_counter = 0.0f
 
unsigned int current_bytes_transfered = 0
 
unsigned int current_bytes_received = 0
 
unsigned int current_bytes_lost = 0
 
float max_kbps = 0.0f
 
float cur_kbps = 0.0f
 
float avg_kbps = 0.0f
 
float max_incoming_kbps = 0.0f
 
float cur_incoming_kbps = 0.0f
 
float avg_incoming_kbps = 0.0f
 
float max_kbps_lost = 0.0f
 
float cur_kbps_lost = 0.0f
 
float avg_kbps_lost = 0.0f
 
float bpm_counter = 0.0f
 
unsigned int rate_samples = 0
 

Constructor & Destructor Documentation

◆ Channel()

con::Channel::Channel ( )
default

◆ ~Channel()

con::Channel::~Channel ( )
default

Member Function Documentation

◆ getAvgDownloadRateKB()

float con::Channel::getAvgDownloadRateKB ( )
inline

References avg_kbps, and m_internal_mutex.

◆ getAvgIncomingRateKB()

float con::Channel::getAvgIncomingRateKB ( )
inline

◆ getAvgLossRateKB()

float con::Channel::getAvgLossRateKB ( )
inline

References avg_kbps_lost, and m_internal_mutex.

◆ getCurrentDownloadRateKB()

float con::Channel::getCurrentDownloadRateKB ( )
inline

References cur_kbps, and m_internal_mutex.

◆ getCurrentIncomingRateKB()

float con::Channel::getCurrentIncomingRateKB ( )
inline

◆ getCurrentLossRateKB()

float con::Channel::getCurrentLossRateKB ( )
inline

References cur_kbps_lost, and m_internal_mutex.

◆ getMaxDownloadRateKB()

float con::Channel::getMaxDownloadRateKB ( )
inline

References m_internal_mutex, and max_kbps.

◆ getMaxIncomingRateKB()

float con::Channel::getMaxIncomingRateKB ( )
inline

◆ getMaxLossRateKB()

float con::Channel::getMaxLossRateKB ( )
inline

References m_internal_mutex, and max_kbps_lost.

◆ getOutgoingSequenceNumber()

u16 con::Channel::getOutgoingSequenceNumber ( bool & successful)

References con::ReliablePacketBuffer::empty(), con::ReliablePacketBuffer::getFirstSeqnum(), m_internal_mutex, m_window_size, next_outgoing_seqnum, outgoing_reliables_sent, and SEQNUM_MAX.

Referenced by con::UDPPeer::processReliableSendCommand(), and con::ConnectionSendThread::rawSendAsPacket().

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

◆ getWindowSize()

u16 con::Channel::getWindowSize ( ) const
inline

References m_window_size.

Referenced by con::UDPPeer::PutReliableSendCommand(), con::ConnectionSendThread::rawSendAsPacket(), and con::ConnectionSendThread::sendPackets().

+ Here is the caller graph for this function:

◆ incNextIncomingSeqNum()

u16 con::Channel::incNextIncomingSeqNum ( )

References m_internal_mutex, and next_incoming_seqnum.

Referenced by con::ConnectionReceiveThread::checkIncomingBuffers(), and con::ConnectionReceiveThread::handlePacketType_Reliable().

+ Here is the caller graph for this function:

◆ putBackSequenceNumber()

bool con::Channel::putBackSequenceNumber ( u16 seqnum)

References next_outgoing_seqnum, and SEQNUM_MAX.

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

+ Here is the caller graph for this function:

◆ readNextIncomingSeqNum()

u16 con::Channel::readNextIncomingSeqNum ( )

References m_internal_mutex, and next_incoming_seqnum.

Referenced by con::ConnectionReceiveThread::checkIncomingBuffers(), con::ConnectionReceiveThread::handlePacketType_Reliable(), and con::ConnectionSendThread::sendPackets().

+ Here is the caller graph for this function:

◆ readNextSplitSeqNum()

u16 con::Channel::readNextSplitSeqNum ( )

References m_internal_mutex, and next_outgoing_split_seqnum.

Referenced by con::UDPPeer::getNextSplitSequenceNumber(), and con::UDPPeer::processReliableSendCommand().

+ Here is the caller graph for this function:

◆ readOutgoingSequenceNumber()

u16 con::Channel::readOutgoingSequenceNumber ( )

References m_internal_mutex, and next_outgoing_seqnum.

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

+ Here is the caller graph for this function:

◆ setNextSplitSeqNum()

void con::Channel::setNextSplitSeqNum ( u16 seqnum)

References m_internal_mutex, and next_outgoing_split_seqnum.

Referenced by con::UDPPeer::processReliableSendCommand(), and con::UDPPeer::setNextSplitSequenceNumber().

+ Here is the caller graph for this function:

◆ setWindowSize()

void con::Channel::setWindowSize ( long size)
inline

References m_window_size, MAX_RELIABLE_WINDOW_SIZE_SEND, MIN_RELIABLE_WINDOW_SIZE, and rangelim.

Referenced by UpdateTimers().

+ Here is the caller graph for this function:

◆ UpdateBytesLost()

void con::Channel::UpdateBytesLost ( unsigned int bytes)

References current_bytes_lost, and m_internal_mutex.

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

+ Here is the caller graph for this function:

◆ UpdateBytesReceived()

void con::Channel::UpdateBytesReceived ( unsigned int bytes)

References current_bytes_received, and m_internal_mutex.

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

+ Here is the caller graph for this function:

◆ UpdateBytesSent()

void con::Channel::UpdateBytesSent ( unsigned int bytes,
unsigned int packages = 1 )

References current_bytes_transfered, current_packet_successful, and m_internal_mutex.

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

+ Here is the caller graph for this function:

◆ UpdatePacketLossCounter()

void con::Channel::UpdatePacketLossCounter ( unsigned int count)

◆ UpdatePacketTooLateCounter()

void con::Channel::UpdatePacketTooLateCounter ( )

References current_packet_too_late, and m_internal_mutex.

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

+ Here is the caller graph for this function:

◆ UpdateTimers()

void con::Channel::UpdateTimers ( float dtime)

Member Data Documentation

◆ avg_incoming_kbps

float con::Channel::avg_incoming_kbps = 0.0f
private

◆ avg_kbps

float con::Channel::avg_kbps = 0.0f
private

◆ avg_kbps_lost

float con::Channel::avg_kbps_lost = 0.0f
private

Referenced by getAvgLossRateKB(), and UpdateTimers().

◆ bpm_counter

float con::Channel::bpm_counter = 0.0f
private

Referenced by UpdateTimers().

◆ cur_incoming_kbps

float con::Channel::cur_incoming_kbps = 0.0f
private

◆ cur_kbps

float con::Channel::cur_kbps = 0.0f
private

◆ cur_kbps_lost

float con::Channel::cur_kbps_lost = 0.0f
private

◆ current_bytes_lost

unsigned int con::Channel::current_bytes_lost = 0
private

Referenced by UpdateBytesLost(), and UpdateTimers().

◆ current_bytes_received

unsigned int con::Channel::current_bytes_received = 0
private

◆ current_bytes_transfered

unsigned int con::Channel::current_bytes_transfered = 0
private

Referenced by UpdateBytesSent(), and UpdateTimers().

◆ current_packet_loss

unsigned int con::Channel::current_packet_loss = 0
private

◆ current_packet_successful

unsigned int con::Channel::current_packet_successful = 0
private

Referenced by UpdateBytesSent(), and UpdateTimers().

◆ current_packet_too_late

unsigned int con::Channel::current_packet_too_late = 0
private

◆ incoming_reliables

◆ incoming_splits

◆ m_internal_mutex

◆ m_window_size

u16 con::Channel::m_window_size = MIN_RELIABLE_WINDOW_SIZE
private

◆ max_incoming_kbps

float con::Channel::max_incoming_kbps = 0.0f
private

◆ max_kbps

float con::Channel::max_kbps = 0.0f
private

◆ max_kbps_lost

float con::Channel::max_kbps_lost = 0.0f
private

Referenced by getMaxLossRateKB(), and UpdateTimers().

◆ next_incoming_seqnum

u16 con::Channel::next_incoming_seqnum = SEQNUM_INITIAL
private

◆ next_outgoing_seqnum

u16 con::Channel::next_outgoing_seqnum = SEQNUM_INITIAL
private

◆ next_outgoing_split_seqnum

u16 con::Channel::next_outgoing_split_seqnum = SEQNUM_INITIAL
private

◆ outgoing_reliables_sent

◆ packet_loss_counter

float con::Channel::packet_loss_counter = 0.0f
private

Referenced by UpdateTimers().

◆ queued_commands

std::deque<ConnectionCommandPtr> con::Channel::queued_commands

◆ queued_reliables

◆ rate_samples

unsigned int con::Channel::rate_samples = 0
private

Referenced by UpdateTimers().


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