#include <impl.h>
Inheritance diagram for con::Connection:
Collaboration diagram for con::Connection:Public Member Functions | |
| Connection (u32 max_packet_size, float timeout, bool ipv6, PeerHandler *peerhandler) | |
| ~Connection () | |
| ConnectionEventPtr | waitEvent (u32 timeout_ms) |
| void | putCommand (ConnectionCommandPtr c) |
| void | Serve (Address bind_addr) |
| void | Connect (Address address) |
| bool | Connected () |
| void | Disconnect () |
| bool | ReceiveTimeoutMs (NetworkPacket *pkt, u32 timeout_ms) |
| void | Send (session_t peer_id, u8 channelnum, NetworkPacket *pkt, bool reliable) |
| session_t | GetPeerID () const |
| Address | GetPeerAddress (session_t peer_id) |
| float | getPeerStat (session_t peer_id, rtt_stat_type type) |
| float | getLocalStat (rate_stat_type type) |
| u32 | GetProtocolID () const |
| const std::string | getDesc () |
| void | DisconnectPeer (session_t peer_id) |
Public Member Functions inherited from con::IConnection | |
| virtual | ~IConnection ()=default |
| bool | TryReceive (NetworkPacket *pkt) |
Protected Member Functions | |
| PeerHelper | getPeerNoEx (session_t peer_id) |
| session_t | lookupPeer (const Address &sender) |
| session_t | createPeer (const Address &sender, int fd) |
| UDPPeer * | createServerPeer (const Address &sender) |
| bool | deletePeer (session_t peer_id, bool timeout) |
| void | SetPeerID (session_t id) |
| void | doResendOne (session_t peer_id) |
| void | sendAck (session_t peer_id, u8 channelnum, u16 seqnum) |
| std::vector< session_t > | getPeerIDs () |
| u32 | getActiveCount () |
| void | putEvent (ConnectionEventPtr e) |
| void | TriggerSend () |
| bool | ConnectedToServer () |
Protected Attributes | |
| UDPSocket | m_udpSocket |
| MutexedQueue< ConnectionCommandPtr > | m_command_queue |
Private Attributes | |
| MutexedQueue< ConnectionEventPtr > | m_event_queue |
| session_t | m_peer_id = 0 |
| u32 | m_protocol_id |
| std::map< session_t, Peer * > | m_peers |
| std::vector< session_t > | m_peer_ids |
| std::mutex | m_peers_mutex |
| std::unique_ptr< ConnectionSendThread > | m_sendThread |
| std::unique_ptr< ConnectionReceiveThread > | m_receiveThread |
| std::mutex | m_info_mutex |
| PeerHandler * | m_bc_peerhandler |
| bool | m_shutting_down = false |
Friends | |
| class | ConnectionSendThread |
| class | ConnectionReceiveThread |
| con::Connection::Connection | ( | u32 | max_packet_size, |
| float | timeout, | ||
| bool | ipv6, | ||
| PeerHandler * | peerhandler ) |
References m_receiveThread, m_sendThread, m_udpSocket, and UDPSocket::setTimeoutMs().
Here is the call graph for this function:| con::Connection::~Connection | ( | ) |
References m_peers, m_receiveThread, m_sendThread, and m_shutting_down.
|
virtual |
Implements con::IConnection.
References con::ConnectionCommand::connect(), and putCommand().
Here is the call graph for this function:
|
virtual |
Implements con::IConnection.
References m_peer_id, m_peers, m_peers_mutex, PEER_ID_INEXISTENT, and PEER_ID_SERVER.
|
inlineprotected |
References getPeerNoEx(), and PEER_ID_SERVER.
Referenced by createServerPeer(), and con::ConnectionReceiveThread::receive().
Here is the call graph for this function:
Here is the caller graph for this function:References CONTROLTYPE_SET_PEER_ID, con::ConnectionCommand::createPeer(), dout_con, errorstream, getDesc(), con::IPeer::id, LOG, m_peer_ids, m_peers, m_peers_mutex, MAX_UDP_PEERS, myrand_range(), con::PACKET_TYPE_CONTROL, PEER_ID_INEXISTENT, con::ConnectionEvent::peerAdded(), putCommand(), putEvent(), writeU16(), and writeU8().
Referenced by con::ConnectionReceiveThread::receive().
Here is the call graph for this function:
Here is the caller graph for this function:References ConnectedToServer(), con::IPeer::id, m_peer_ids, m_peers, m_peers_mutex, PEER_ID_SERVER, and con::Peer::SetFullyOpen().
Referenced by con::ConnectionSendThread::connect().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protected |
References con::Peer::Drop(), con::IPeer::getAddress(), m_peer_ids, m_peers, m_peers_mutex, con::ConnectionEvent::peerRemoved(), and putEvent().
Referenced by con::ConnectionReceiveThread::handlePacketType_Control(), con::ConnectionSendThread::runTimeouts(), and con::ConnectionSendThread::sendPackets().
Here is the call graph for this function:
Here is the caller graph for this function:
|
virtual |
Implements con::IConnection.
References con::ConnectionCommand::disconnect(), and putCommand().
Here is the call graph for this function:
|
virtual |
Implements con::IConnection.
References con::ConnectionCommand::disconnect_peer(), and putCommand().
Here is the call graph for this function:
|
protected |
References PEER_ID_INEXISTENT, putCommand(), and con::ConnectionCommand::resend_one().
Referenced by con::ConnectionReceiveThread::receive().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protected |
References con::Peer::isHalfOpen(), con::Peer::isPendingDeletion(), m_peers, and m_peers_mutex.
Referenced by con::ConnectionSendThread::run().
Here is the call graph for this function:
Here is the caller graph for this function:| const std::string con::Connection::getDesc | ( | ) |
References _, UDPSocket::GetHandle(), itos(), m_info_mutex, m_peer_id, and m_udpSocket.
Referenced by con::ConnectionReceiveThread::checkIncomingBuffers(), con::ConnectionSendThread::connect(), createPeer(), con::ConnectionSendThread::disconnect(), con::ConnectionSendThread::disconnect_peer(), con::Peer::Drop(), con::ConnectionReceiveThread::handlePacketType_Control(), con::ConnectionReceiveThread::handlePacketType_Original(), con::ConnectionReceiveThread::handlePacketType_Reliable(), con::ConnectionReceiveThread::handlePacketType_Split(), con::ConnectionSendThread::processNonReliableCommand(), con::ConnectionReceiveThread::processPacket(), con::ConnectionSendThread::processReliableCommand(), con::UDPPeer::processReliableSendCommand(), con::UDPPeer::PutReliableSendCommand(), con::ConnectionSendThread::rawSend(), con::ConnectionSendThread::rawSendAsPacket(), con::ConnectionReceiveThread::receive(), ReceiveTimeoutMs(), con::UDPPeer::reportRTT(), con::ConnectionSendThread::resendReliable(), con::ConnectionReceiveThread::run(), con::ConnectionSendThread::run(), con::UDPPeer::RunCommandQueues(), con::ConnectionSendThread::runTimeouts(), con::ConnectionSendThread::send(), sendAck(), con::ConnectionSendThread::sendAsPacketReliable(), con::ConnectionSendThread::sendPackets(), and con::ConnectionSendThread::serve().
Here is the call graph for this function:
Here is the caller graph for this function:
|
virtual |
Implements con::IConnection.
References con::AVG_DL_RATE, con::AVG_INC_RATE, con::AVG_LOSS_RATE, con::CUR_DL_RATE, con::CUR_INC_RATE, con::CUR_LOSS_RATE, FATAL_ERROR, FATAL_ERROR_IF, getPeerNoEx(), and PEER_ID_SERVER.
Here is the call graph for this function:Implements con::IConnection.
References con::IPeer::getAddress(), and getPeerNoEx().
Here is the call graph for this function:
|
inlinevirtual |
Implements con::IConnection.
References m_peer_id.
Referenced by con::ConnectionReceiveThread::handlePacketType_Control(), con::UDPPeer::processReliableSendCommand(), and con::ConnectionSendThread::rawSendAsPacket().
Here is the caller graph for this function:
|
inlineprotected |
References m_peer_ids, and m_peers_mutex.
Referenced by con::ConnectionSendThread::disconnect(), con::ConnectionReceiveThread::getFromBuffers(), con::ConnectionSendThread::packetsQueued(), con::ConnectionReceiveThread::run(), con::ConnectionSendThread::runTimeouts(), con::ConnectionSendThread::sendPackets(), con::ConnectionSendThread::sendToAll(), and con::ConnectionSendThread::sendToAllReliable().
Here is the caller graph for this function:
|
protected |
References FATAL_ERROR_IF, m_peers, and m_peers_mutex.
Referenced by ConnectedToServer(), con::ConnectionSendThread::disconnect_peer(), con::ConnectionReceiveThread::getFromBuffers(), getLocalStat(), GetPeerAddress(), getPeerStat(), con::ConnectionSendThread::packetsQueued(), con::ConnectionReceiveThread::processPacket(), con::ConnectionSendThread::processReliableCommand(), con::ConnectionSendThread::rawSendAsPacket(), con::ConnectionReceiveThread::receive(), con::ConnectionReceiveThread::run(), con::ConnectionSendThread::runTimeouts(), con::ConnectionSendThread::send(), con::ConnectionSendThread::sendPackets(), con::ConnectionSendThread::sendReliable(), and con::ConnectionSendThread::sendToAllReliable().
Here is the caller graph for this function:
|
virtual |
Implements con::IConnection.
References getPeerNoEx(), and con::Peer::getStat().
Here is the call graph for this function:
|
inline |
References m_protocol_id.
Referenced by con::ConnectionReceiveThread::handlePacketType_Reliable(), con::ConnectionReceiveThread::handlePacketType_Split(), con::UDPPeer::processReliableSendCommand(), con::ConnectionSendThread::rawSendAsPacket(), and con::ConnectionReceiveThread::receive().
Here is the caller graph for this function:References con::IPeer::getAddress(), con::IPeer::id, con::Peer::isPendingDeletion(), m_peers, m_peers_mutex, and PEER_ID_INEXISTENT.
Referenced by con::ConnectionReceiveThread::receive().
Here is the call graph for this function:
Here is the caller graph for this function:| void con::Connection::putCommand | ( | ConnectionCommandPtr | c | ) |
References m_command_queue, m_sendThread, m_shutting_down, and MutexedQueue< T >::push_back().
Referenced by Connect(), createPeer(), Disconnect(), DisconnectPeer(), doResendOne(), con::ConnectionReceiveThread::handlePacketType_Reliable(), Send(), sendAck(), and Serve().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protected |
References con::CONNEVENT_NONE, m_event_queue, and MutexedQueue< T >::push_back().
Referenced by con::ConnectionSendThread::connect(), createPeer(), deletePeer(), con::ConnectionReceiveThread::receive(), and con::ConnectionSendThread::serve().
Here is the call graph for this function:
Here is the caller graph for this function:
|
virtual |
Implements con::IConnection.
References con::ConnectionEvent::address, con::CONNEVENT_BIND_FAILED, con::CONNEVENT_DATA_RECEIVED, con::CONNEVENT_NONE, con::CONNEVENT_PEER_ADDED, con::CONNEVENT_PEER_REMOVED, con::ConnectionEvent::data, con::PeerHandler::deletingPeer(), con::ConnectionEvent::describe(), dout_con, getDesc(), Buffer< T >::getSize(), LOG, m_bc_peerhandler, con::ConnectionEvent::peer_id, con::PeerHandler::peerAdded(), NetworkPacket::putRawPacket(), con::ConnectionEvent::timeout, con::ConnectionEvent::type, and waitEvent().
Here is the call graph for this function:
|
virtual |
Implements con::IConnection.
References CHANNEL_COUNT, FATAL_ERROR, NetworkPacket::getCommand(), NetworkPacket::getSize(), MAX_RELIABLE_WINDOW_SIZE, putCommand(), and con::ConnectionCommand::send().
Referenced by con::ConnectionSendThread::connect().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protected |
References con::ConnectionCommand::ack(), CHANNEL_COUNT, CONTROLTYPE_ACK, dout_con, getDesc(), LOG, m_sendThread, con::PACKET_TYPE_CONTROL, putCommand(), writeU16(), and writeU8().
Referenced by con::ConnectionReceiveThread::handlePacketType_Reliable().
Here is the call graph for this function:
Here is the caller graph for this function:
|
virtual |
Implements con::IConnection.
References putCommand(), and con::ConnectionCommand::serve().
Here is the call graph for this function:
|
inlineprotected |
References m_peer_id.
Referenced by con::ConnectionSendThread::connect(), con::ConnectionReceiveThread::handlePacketType_Control(), and con::ConnectionSendThread::serve().
Here is the caller graph for this function:
|
protected |
References m_sendThread.
Referenced by con::ConnectionReceiveThread::handlePacketType_Control().
Here is the caller graph for this function:| ConnectionEventPtr con::Connection::waitEvent | ( | u32 | timeout_ms | ) |
References con::CONNEVENT_NONE, con::ConnectionEvent::create(), m_event_queue, and MutexedQueue< T >::pop_front().
Referenced by ReceiveTimeoutMs().
Here is the call graph for this function:
Here is the caller graph for this function:
|
friend |
|
friend |
|
private |
Referenced by ReceiveTimeoutMs().
|
protected |
Referenced by putCommand(), and con::ConnectionSendThread::run().
|
private |
Referenced by putEvent(), and waitEvent().
|
mutableprivate |
Referenced by getDesc().
|
private |
Referenced by Connected(), getDesc(), GetPeerID(), and SetPeerID().
|
private |
Referenced by createPeer(), createServerPeer(), deletePeer(), and getPeerIDs().
Referenced by ~Connection(), Connected(), createPeer(), createServerPeer(), deletePeer(), getActiveCount(), getPeerNoEx(), and lookupPeer().
|
private |
Referenced by Connected(), createPeer(), createServerPeer(), deletePeer(), getActiveCount(), getPeerIDs(), getPeerNoEx(), and lookupPeer().
|
private |
Referenced by GetProtocolID().
|
private |
Referenced by Connection(), and ~Connection().
|
private |
Referenced by Connection(), ~Connection(), putCommand(), sendAck(), and TriggerSend().
|
private |
Referenced by ~Connection(), and putCommand().
|
protected |