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

#include <threads.h>

+ Inheritance diagram for con::ConnectionReceiveThread:
+ Collaboration diagram for con::ConnectionReceiveThread:

Classes

struct  PacketTypeHandler
 
struct  RateLimitHelper
 

Public Member Functions

 ConnectionReceiveThread ()
 
void * run ()
 
void setParent (Connection *parent)
 
- Public Member Functions inherited from Thread
 Thread (const std::string &name="")
 
virtual ~Thread ()
 
bool start ()
 
bool stop ()
 
bool wait ()
 
bool isCurrentThread ()
 
bool isRunning ()
 
bool stopRequested ()
 
std::thread::id getThreadId ()
 
bool getReturnValue (void **ret)
 
bool bindToProcessor (unsigned int proc_number)
 
bool setPriority (int prio)
 

Private Member Functions

void receive (SharedBuffer< u8 > &packetdata, bool &packet_queued)
 
bool getFromBuffers (session_t &peer_id, SharedBuffer< u8 > &dst)
 
bool checkIncomingBuffers (Channel *channel, session_t &peer_id, SharedBuffer< u8 > &dst)
 
SharedBuffer< u8 > processPacket (Channel *channel, const SharedBuffer< u8 > &packetdata, session_t peer_id, u8 channelnum, bool reliable)
 
SharedBuffer< u8 > handlePacketType_Control (Channel *channel, const SharedBuffer< u8 > &packetdata, Peer *peer, u8 channelnum, bool reliable)
 
SharedBuffer< u8 > handlePacketType_Original (Channel *channel, const SharedBuffer< u8 > &packetdata, Peer *peer, u8 channelnum, bool reliable)
 
SharedBuffer< u8 > handlePacketType_Split (Channel *channel, const SharedBuffer< u8 > &packetdata, Peer *peer, u8 channelnum, bool reliable)
 
SharedBuffer< u8 > handlePacketType_Reliable (Channel *channel, const SharedBuffer< u8 > &packetdata, Peer *peer, u8 channelnum, bool reliable)
 

Private Attributes

Connectionm_connection = nullptr
 
RateLimitHelper m_new_peer_ratelimit
 

Static Private Attributes

static const PacketTypeHandler packetTypeRouter [PACKET_TYPE_MAX]
 

Additional Inherited Members

- Static Public Member Functions inherited from Thread
static ThreadgetCurrentThread ()
 
static void setName (const std::string &name)
 
static unsigned int getNumberOfProcessors ()
 
- Protected Attributes inherited from Thread
std::string m_name
 

Constructor & Destructor Documentation

◆ ConnectionReceiveThread()

con::ConnectionReceiveThread::ConnectionReceiveThread ( )

Member Function Documentation

◆ checkIncomingBuffers()

bool con::ConnectionReceiveThread::checkIncomingBuffers ( Channel * channel,
session_t & peer_id,
SharedBuffer< u8 > & dst )
private

References BASE_HEADER_SIZE, dout_con, con::Connection::getDesc(), con::ReliablePacketBuffer::getFirstSeqnum(), SharedBuffer< T >::getSize(), con::Channel::incNextIncomingSeqNum(), con::Channel::incoming_reliables, LOG, m_connection, p(), con::ReliablePacketBuffer::popFirst(), processPacket(), con::readChannel(), con::Channel::readNextIncomingSeqNum(), con::readPeerId(), and RELIABLE_HEADER_SIZE.

Referenced by getFromBuffers().

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

◆ getFromBuffers()

bool con::ConnectionReceiveThread::getFromBuffers ( session_t & peer_id,
SharedBuffer< u8 > & dst )
private

References checkIncomingBuffers(), con::Connection::getPeerIDs(), con::Connection::getPeerNoEx(), m_connection, and p().

Referenced by receive().

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

◆ handlePacketType_Control()

◆ handlePacketType_Original()

SharedBuffer< u8 > con::ConnectionReceiveThread::handlePacketType_Original ( Channel * channel,
const SharedBuffer< u8 > & packetdata,
Peer * peer,
u8 channelnum,
bool reliable )
private

References dout_con, con::Connection::getDesc(), SharedBuffer< T >::getSize(), LOG, m_connection, and ORIGINAL_HEADER_SIZE.

+ Here is the call graph for this function:

◆ handlePacketType_Reliable()

◆ handlePacketType_Split()

SharedBuffer< u8 > con::ConnectionReceiveThread::handlePacketType_Split ( Channel * channel,
const SharedBuffer< u8 > & packetdata,
Peer * peer,
u8 channelnum,
bool reliable )
private

References con::Peer::addSplitPacket(), dout_con, con::IPeer::getAddress(), con::Connection::getDesc(), con::Connection::GetProtocolID(), SharedBuffer< T >::getSize(), con::IPeer::id, LOG, m_connection, and con::makePacket().

+ Here is the call graph for this function:

◆ processPacket()

SharedBuffer< u8 > con::ConnectionReceiveThread::processPacket ( Channel * channel,
const SharedBuffer< u8 > & packetdata,
session_t peer_id,
u8 channelnum,
bool reliable )
private

References derr_con, errorstream, con::Connection::getDesc(), con::Connection::getPeerNoEx(), SharedBuffer< T >::getSize(), con::ConnectionReceiveThread::PacketTypeHandler::handler, itos(), m_connection, MAX_UDP_PEERS, con::PACKET_TYPE_MAX, packetTypeRouter, and readU8().

Referenced by checkIncomingBuffers(), handlePacketType_Reliable(), and receive().

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

◆ receive()

◆ run()

void * con::ConnectionReceiveThread::run ( )
virtual

Implements Thread.

References BEGIN_DEBUG_EXCEPTION_HANDLER, con::CALC_DTIME(), CHANNEL_COUNT, dout_con, END_DEBUG_EXCEPTION_HANDLER, g_profiler, con::Connection::getDesc(), con::Connection::getPeerIDs(), con::Connection::getPeerNoEx(), porting::getTimeMs(), LOG, m_connection, PROFILE, receive(), Profiler::remove(), SPT_AVG, and Thread::stopRequested().

+ Here is the call graph for this function:

◆ setParent()

void con::ConnectionReceiveThread::setParent ( Connection * parent)
inline

References m_connection.

Member Data Documentation

◆ m_connection

◆ m_new_peer_ratelimit

RateLimitHelper con::ConnectionReceiveThread::m_new_peer_ratelimit
private

Referenced by receive().

◆ packetTypeRouter

const ConnectionReceiveThread::PacketTypeHandler con::ConnectionReceiveThread::packetTypeRouter
staticprivate
Initial value:
= {
}
SharedBuffer< u8 > handlePacketType_Reliable(Channel *channel, const SharedBuffer< u8 > &packetdata, Peer *peer, u8 channelnum, bool reliable)
Definition threads.cpp:1293
SharedBuffer< u8 > handlePacketType_Original(Channel *channel, const SharedBuffer< u8 > &packetdata, Peer *peer, u8 channelnum, bool reliable)
Definition threads.cpp:1255
SharedBuffer< u8 > handlePacketType_Split(Channel *channel, const SharedBuffer< u8 > &packetdata, Peer *peer, u8 channelnum, bool reliable)
Definition threads.cpp:1269
SharedBuffer< u8 > handlePacketType_Control(Channel *channel, const SharedBuffer< u8 > &packetdata, Peer *peer, u8 channelnum, bool reliable)
Definition threads.cpp:1154

Referenced by processPacket().


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