#include <connectionthreads.h>
|
void | runTimeouts (float dtime) |
|
void | rawSend (const BufferedPacket &packet) |
|
bool | rawSendAsPacket (session_t peer_id, u8 channelnum, const SharedBuffer< u8 > &data, bool reliable) |
|
void | processReliableCommand (ConnectionCommand &c) |
|
void | processNonReliableCommand (ConnectionCommand &c) |
|
void | serve (Address bind_address) |
|
void | connect (Address address) |
|
void | disconnect () |
|
void | disconnect_peer (session_t peer_id) |
|
void | send (session_t peer_id, u8 channelnum, const SharedBuffer< u8 > &data) |
|
void | sendReliable (ConnectionCommand &c) |
|
void | sendToAll (u8 channelnum, const SharedBuffer< u8 > &data) |
|
void | sendToAllReliable (ConnectionCommand &c) |
|
void | sendPackets (float dtime) |
|
void | sendAsPacket (session_t peer_id, u8 channelnum, const SharedBuffer< u8 > &data, bool ack=false) |
|
void | sendAsPacketReliable (BufferedPacket &p, Channel *channel) |
|
bool | packetsQueued () |
|
◆ ConnectionSendThread()
con::ConnectionSendThread::ConnectionSendThread |
( |
unsigned int |
max_packet_size, |
|
|
float |
timeout |
|
) |
| |
◆ connect()
void con::ConnectionSendThread::connect |
( |
Address |
address | ) |
|
|
private |
References con::Peer::address, UDPSocket::Bind(), con::Connection::createServerPeer(), dout_con, con::Connection::getDesc(), Address::getPort(), con::Peer::id, Address::isIPv6(), LOG, m_connection, con::Connection::m_udpSocket, PEER_ID_INEXISTENT, PEER_ID_SERVER, con::ConnectionEvent::peerAdded(), con::Connection::putEvent(), con::Connection::Send(), Address::serializeString(), Address::setAddress(), and con::Connection::SetPeerID().
Referenced by processNonReliableCommand().
◆ disconnect()
void con::ConnectionSendThread::disconnect |
( |
| ) |
|
|
private |
◆ disconnect_peer()
void con::ConnectionSendThread::disconnect_peer |
( |
session_t |
peer_id | ) |
|
|
private |
◆ packetsQueued()
bool con::ConnectionSendThread::packetsQueued |
( |
| ) |
|
|
private |
◆ processNonReliableCommand()
References con::ConnectionCommand::address, con::ConnectionCommand::channelnum, con::CONCMD_ACK, con::CONCMD_CREATE_PEER, con::CONNCMD_CONNECT, con::CONNCMD_DISCONNECT, con::CONNCMD_DISCONNECT_PEER, con::CONNCMD_NONE, con::CONNCMD_SEND, con::CONNCMD_SEND_TO_ALL, con::CONNCMD_SERVE, connect(), con::ConnectionCommand::data, disconnect(), disconnect_peer(), dout_con, FATAL_ERROR, con::Connection::getDesc(), LOG, m_connection, con::ConnectionCommand::peer_id, con::ConnectionCommand::reliable, send(), sendAsPacket(), sendToAll(), Address::serializeString(), serve(), and con::ConnectionCommand::type.
Referenced by run().
◆ processReliableCommand()
References con::ConnectionCommand::channelnum, con::CONCMD_ACK, con::CONCMD_CREATE_PEER, con::CONNCMD_CONNECT, con::CONNCMD_DISCONNECT, con::CONNCMD_NONE, con::CONNCMD_SEND, con::CONNCMD_SEND_TO_ALL, con::CONNCMD_SERVE, con::ConnectionCommand::data, dout_con, FATAL_ERROR, con::Connection::getDesc(), LOG, m_connection, con::ConnectionCommand::peer_id, rawSendAsPacket(), con::ConnectionCommand::reliable, sendReliable(), sendToAllReliable(), and con::ConnectionCommand::type.
Referenced by run().
◆ rawSend()
void con::ConnectionSendThread::rawSend |
( |
const BufferedPacket & |
packet | ) |
|
|
private |
References con::BufferedPacket::address, con::BufferedPacket::data, derr_con, dout_con, con::Connection::getDesc(), Buffer< T >::getSize(), LOG, m_connection, con::Connection::m_udpSocket, UDPSocket::Send(), and Address::serializeString().
Referenced by rawSendAsPacket(), runTimeouts(), and sendAsPacketReliable().
◆ rawSendAsPacket()
bool con::ConnectionSendThread::rawSendAsPacket |
( |
session_t |
peer_id, |
|
|
u8 |
channelnum, |
|
|
const SharedBuffer< u8 > & |
data, |
|
|
bool |
reliable |
|
) |
| |
|
private |
References dout_con, errorstream, con::Peer::getAddress(), con::Connection::getDesc(), con::Channel::getOutgoingSequenceNumber(), con::Connection::GetPeerID(), con::Connection::getPeerNoEx(), con::Connection::GetProtocolID(), con::Channel::getWindowSize(), LOG, m_connection, con::makePacket(), con::makeReliablePacket(), con::MTP_MINETEST_RELIABLE_UDP, con::MTP_UDP, con::Channel::outgoing_reliables_sent, p(), con::Channel::queued_reliables, rawSend(), sendAsPacketReliable(), and con::ReliablePacketBuffer::size().
Referenced by processReliableCommand(), runTimeouts(), and sendPackets().
◆ run()
void * con::ConnectionSendThread::run |
( |
| ) |
|
|
virtual |
Implements Thread.
References BEGIN_DEBUG_EXCEPTION_HANDLER, con::CALC_DTIME(), con::CONNCMD_NONE, dout_con, END_DEBUG_EXCEPTION_HANDLER, g_profiler, con::Connection::getDesc(), porting::getTimeMs(), LOG, con::Connection::m_command_queue, m_connection, m_iteration_packets_avaialble, m_max_data_packets_per_iteration, m_send_sleep_semaphore, packetsQueued(), processNonReliableCommand(), processReliableCommand(), PROFILE, con::ConnectionCommand::reliable, Profiler::remove(), runTimeouts(), sendPackets(), SPT_AVG, Thread::stopRequested(), con::ConnectionCommand::type, Semaphore::wait(), and warningstream.
◆ runTimeouts()
void con::ConnectionSendThread::runTimeouts |
( |
float |
dtime | ) |
|
|
private |
References BASE_HEADER_SIZE, con::UDPPeer::channels, con::Connection::deletePeer(), derr_con, dout_con, g_profiler, con::Connection::getDesc(), con::Connection::getPeerIDs(), con::Connection::getPeerNoEx(), con::UDPPeer::getResendTimeout(), con::ReliablePacketBuffer::getTimedOuts(), Profiler::graphAdd(), con::Peer::id, con::Channel::incoming_splits, con::ReliablePacketBuffer::incrementTimeouts(), infostream, con::Peer::isTimedOut(), LOG, m_connection, m_iteration_packets_avaialble, m_max_commands_per_iteration, m_max_data_packets_per_iteration, m_max_packet_size, m_max_packets_requeued, con::Connection::m_peers, m_timeout, MAX_RELIABLE_RETRY, con::Channel::outgoing_reliables_sent, con::UDPPeer::Ping(), PROFILE, rawSend(), rawSendAsPacket(), con::readChannel(), con::readPeerId(), readU16(), con::IncomingSplitBuffer::removeUnreliableTimedOuts(), con::UDPPeer::RunCommandQueues(), SPT_AVG, con::Channel::UpdateBytesLost(), con::Channel::UpdatePacketLossCounter(), and con::Channel::UpdateTimers().
Referenced by run().
◆ send()
void con::ConnectionSendThread::send |
( |
session_t |
peer_id, |
|
|
u8 |
channelnum, |
|
|
const SharedBuffer< u8 > & |
data |
|
) |
| |
|
private |
References BASE_HEADER_SIZE, CHANNEL_COUNT, dout_con, con::Connection::getDesc(), con::Peer::getNextSplitSequenceNumber(), con::Connection::getPeerNoEx(), SharedBuffer< T >::getSize(), LOG, m_connection, m_max_packet_size, con::makeAutoSplitPacket(), sendAsPacket(), and con::Peer::setNextSplitSequenceNumber().
Referenced by processNonReliableCommand(), and sendToAll().
◆ sendAsPacket()
void con::ConnectionSendThread::sendAsPacket |
( |
session_t |
peer_id, |
|
|
u8 |
channelnum, |
|
|
const SharedBuffer< u8 > & |
data, |
|
|
bool |
ack = false |
|
) |
| |
|
private |
◆ sendAsPacketReliable()
References derr_con, con::Connection::getDesc(), porting::getTimeMs(), con::ReliablePacketBuffer::insert(), LOG, m_connection, MAX_RELIABLE_WINDOW_SIZE, con::Channel::outgoing_reliables_sent, p(), rawSend(), and con::Channel::readOutgoingSequenceNumber().
Referenced by rawSendAsPacket(), and sendPackets().
◆ sendPackets()
void con::ConnectionSendThread::sendPackets |
( |
float |
dtime | ) |
|
|
private |
References con::OutgoingPacket::ack, BASE_HEADER_SIZE, CHANNEL_COUNT, con::OutgoingPacket::channelnum, con::UDPPeer::channels, con::OutgoingPacket::data, con::Connection::deletePeer(), dout_con, g_profiler, con::Connection::getDesc(), con::ReliablePacketBuffer::getFirstSeqnum(), con::Connection::getPeerIDs(), con::Connection::getPeerNoEx(), SharedBuffer< T >::getSize(), con::Channel::getWindowSize(), con::Channel::incoming_reliables, LOG, m_connection, con::Peer::m_increment_packets_remaining, m_iteration_packets_avaialble, m_outgoing_queue, con::UDPPeer::m_pending_disconnect, MYMAX, con::Channel::outgoing_reliables_sent, p(), con::OutgoingPacket::peer_id, PROFILE, con::Channel::queued_commands, con::Channel::queued_reliables, rawSendAsPacket(), con::Channel::readNextIncomingSeqNum(), readU16(), con::OutgoingPacket::reliable, sendAsPacketReliable(), con::ReliablePacketBuffer::size(), SPT_AVG, Thread::stopRequested(), and warningstream.
Referenced by run().
◆ sendReliable()
◆ sendToAll()
void con::ConnectionSendThread::sendToAll |
( |
u8 |
channelnum, |
|
|
const SharedBuffer< u8 > & |
data |
|
) |
| |
|
private |
◆ sendToAllReliable()
◆ serve()
void con::ConnectionSendThread::serve |
( |
Address |
bind_address | ) |
|
|
private |
References UDPSocket::Bind(), con::ConnectionEvent::bindFailed(), dout_con, con::Connection::getDesc(), LOG, m_connection, con::Connection::m_udpSocket, PEER_ID_SERVER, con::Connection::putEvent(), Address::serializeString(), and con::Connection::SetPeerID().
Referenced by processNonReliableCommand().
◆ setParent()
void con::ConnectionSendThread::setParent |
( |
Connection * |
parent | ) |
|
|
inline |
◆ setPeerTimeout()
void con::ConnectionSendThread::setPeerTimeout |
( |
float |
peer_timeout | ) |
|
|
inline |
◆ Trigger()
void con::ConnectionSendThread::Trigger |
( |
| ) |
|
◆ UDPPeer
◆ m_connection
Connection* con::ConnectionSendThread::m_connection = nullptr |
|
private |
Referenced by connect(), disconnect(), disconnect_peer(), packetsQueued(), processNonReliableCommand(), processReliableCommand(), rawSend(), rawSendAsPacket(), run(), runTimeouts(), send(), sendAsPacketReliable(), sendPackets(), sendReliable(), sendToAll(), sendToAllReliable(), serve(), and setParent().
◆ m_iteration_packets_avaialble
unsigned int con::ConnectionSendThread::m_iteration_packets_avaialble |
|
private |
◆ m_max_commands_per_iteration
unsigned int con::ConnectionSendThread::m_max_commands_per_iteration = 1 |
|
private |
◆ m_max_data_packets_per_iteration
unsigned int con::ConnectionSendThread::m_max_data_packets_per_iteration |
|
private |
◆ m_max_packet_size
unsigned int con::ConnectionSendThread::m_max_packet_size |
|
private |
◆ m_max_packets_requeued
unsigned int con::ConnectionSendThread::m_max_packets_requeued = 256 |
|
private |
◆ m_outgoing_queue
std::queue<OutgoingPacket> con::ConnectionSendThread::m_outgoing_queue |
|
private |
◆ m_send_sleep_semaphore
Semaphore con::ConnectionSendThread::m_send_sleep_semaphore |
|
private |
◆ m_timeout
float con::ConnectionSendThread::m_timeout |
|
private |
The documentation for this class was generated from the following files: