#include <Connection.h>
Inherits MemoryPoolObject.
Public Member Functions | |
| Connection () | |
| void | update () |
| void | init () |
| void | reset () |
| UnsignedInt | doSend () |
| void | doRecv () |
| Bool | allCommandsReady (UnsignedInt frame) |
| Bool | isQueueEmpty () |
| void | attachTransport (Transport *transport) |
| void | setUser (User *user) |
| User * | getUser () |
| void | setFrameGrouping (time_t frameGrouping) |
| void | sendNetCommandMsg (NetCommandMsg *msg, UnsignedByte relay) |
| NetCommandRef * | processAck (NetAckBothCommandMsg *msg) |
| NetCommandRef * | processAck (NetAckStage1CommandMsg *msg) |
| NetCommandRef * | processAck (NetCommandMsg *msg) |
| NetCommandRef * | processAck (UnsignedShort commandID, UnsignedByte originalPlayerID) |
| void | clearCommandsExceptFrom (Int playerIndex) |
| void | setQuitting (void) |
| Bool | isQuitting (void) |
Public Member Functions inherited from MemoryPoolObject | |
| void | deleteInstance () |
Protected Member Functions | |
| void | doRetryMetrics () |
Protected Member Functions inherited from MemoryPoolObject | |
| virtual | ~MemoryPoolObject () |
| void * | operator new (size_t s) |
| void | operator delete (void *p) |
| virtual MemoryPool * | getObjectMemoryPool ()=0 |
Protected Attributes | |
| Bool | m_isQuitting |
| UnsignedInt | m_quitTime |
| Transport * | m_transport |
| User * | m_user |
| NetCommandList * | m_netCommandList |
| time_t | m_retryTime |
| The time between sending retry packets for this connection. Time is in milliseconds. | |
| Real | m_averageLatency |
| The average time between sending a command and receiving an ACK. | |
| Real | m_latencies [CONNECTION_LATENCY_HISTORY_LENGTH] |
| List of the last 100 latencies. | |
| time_t | m_frameGrouping |
| The minimum time between packet sends. | |
| time_t | m_lastTimeSent |
| The time of the last packet send. | |
| Int | m_numRetries |
| The number of retries for the last second. | |
| time_t | m_retryMetricsTime |
| The start time of the current retry metrics thing. | |
Definition at line 48 of file Connection.h.
| Connection::Connection | ( | ) |
The constructor.
Definition at line 37 of file Connection.cpp.
| Bool Connection::allCommandsReady | ( | UnsignedInt | frame | ) |
| void Connection::attachTransport | ( | Transport * | transport | ) |
Attach the transport object that this connection should use.
Definition at line 118 of file Connection.cpp.
| void Connection::clearCommandsExceptFrom | ( | Int | playerIndex | ) |
Definition at line 224 of file Connection.cpp.
| void Connection::doRecv | ( | ) |
|
protected |
Definition at line 401 of file Connection.cpp.
| UnsignedInt Connection::doSend | ( | ) |
This is the good part. We take all the network commands queued up for this connection, packetize them and put them on the transport's send queue for actual sending.
Definition at line 262 of file Connection.cpp.
| User * Connection::getUser | ( | ) |
Return the user object.
Definition at line 136 of file Connection.cpp.
| void Connection::init | ( | ) |
Initialize the connection and any subsystems.
Definition at line 75 of file Connection.cpp.
| Bool Connection::isQueueEmpty | ( | ) |
Definition at line 244 of file Connection.cpp.
|
inline |
Definition at line 80 of file Connection.h.
| NetCommandRef * Connection::processAck | ( | NetAckBothCommandMsg * | msg | ) |
Definition at line 340 of file Connection.cpp.
| NetCommandRef * Connection::processAck | ( | NetAckStage1CommandMsg * | msg | ) |
Definition at line 336 of file Connection.cpp.
| NetCommandRef * Connection::processAck | ( | NetCommandMsg * | msg | ) |
Definition at line 344 of file Connection.cpp.
| NetCommandRef * Connection::processAck | ( | UnsignedShort | commandID, |
| UnsignedByte | originalPlayerID ) |
The person we are sending to has ack'd one of the messages we sent him. Take that message off the list of commands to send.
Definition at line 362 of file Connection.cpp.
| void Connection::reset | ( | ) |
Take the connection back to the initial state.
Definition at line 105 of file Connection.cpp.
| void Connection::sendNetCommandMsg | ( | NetCommandMsg * | msg, |
| UnsignedByte | relay ) |
Add this network command to the send queue for this connection. The relay is the mask specifying the people the person we are sending to should send to. The relay mostly has to do with the packet router.
Definition at line 145 of file Connection.cpp.
| void Connection::setFrameGrouping | ( | time_t | frameGrouping | ) |
Definition at line 396 of file Connection.cpp.
| void Connection::setQuitting | ( | void | ) |
Definition at line 251 of file Connection.cpp.
| void Connection::setUser | ( | User * | user | ) |
Assign this connection a user. This is the user to whome we send all our packetized goodies.
Definition at line 125 of file Connection.cpp.
| void Connection::update | ( | ) |
Doesn't really do anything.
Definition at line 112 of file Connection.cpp.
|
protected |
The average time between sending a command and receiving an ACK.
Definition at line 97 of file Connection.h.
|
protected |
The minimum time between packet sends.
Definition at line 100 of file Connection.h.
|
protected |
Definition at line 89 of file Connection.h.
|
protected |
The time of the last packet send.
Definition at line 101 of file Connection.h.
|
protected |
List of the last 100 latencies.
Definition at line 98 of file Connection.h.
|
protected |
Definition at line 95 of file Connection.h.
|
protected |
The number of retries for the last second.
Definition at line 102 of file Connection.h.
|
protected |
Definition at line 90 of file Connection.h.
|
protected |
The start time of the current retry metrics thing.
Definition at line 103 of file Connection.h.
|
protected |
The time between sending retry packets for this connection. Time is in milliseconds.
Definition at line 96 of file Connection.h.
|
protected |
Definition at line 92 of file Connection.h.
|
protected |
Definition at line 93 of file Connection.h.