Changeset 2009
- Timestamp:
- Oct 24, 2008, 4:00:00 PM (16 years ago)
- Location:
- code/branches/objecthierarchy/src/network
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/network/ClientInformation.cc
r1990 r2009 162 162 163 163 enet_uint32 ClientInformation::getRTT(){ 164 return peer_->roundTripTime;165 } 166 167 enet_uint32ClientInformation::getPacketLoss(){168 return peer_->packetLoss;164 return this->peer_->roundTripTime; 165 } 166 167 double ClientInformation::getPacketLoss(){ 168 return ((double)this->peer_->packetLoss)/ENET_PEER_PACKET_LOSS_SCALE; 169 169 } 170 170 -
code/branches/objecthierarchy/src/network/ClientInformation.h
r1960 r2009 85 85 void resetFailures(); 86 86 enet_uint32 getRTT(); 87 enet_uint32getPacketLoss();87 double getPacketLoss(); 88 88 89 89 static bool removeClient(unsigned int clientID); -
code/branches/objecthierarchy/src/network/Server.cc
r1953 r2009 163 163 return connection->addPacket(packet, clientID); 164 164 } 165 165 166 /** 167 * @brief: returns ping time to client in milliseconds 168 */ 169 unsigned int Server::getPing(unsigned int clientID){ 170 assert(ClientInformation::findClient(clientID)); 171 return ClientInformation::findClient(clientID)->getRTT(); 172 } 173 174 /** 175 * @brief: return packet loss ratio to client (scales from 0 to 1) 176 */ 177 double Server::getPacketLoss(unsigned int clientID){ 178 assert(ClientInformation::findClient(clientID)); 179 return ClientInformation::findClient(clientID)->getPacketLoss(); 180 } 181 166 182 /** 167 183 * processes all the packets waiting in the queue -
code/branches/objecthierarchy/src/network/Server.h
r1953 r2009 70 70 bool queuePacket(ENetPacket *packet, int clientID); 71 71 void tick(float time); 72 unsigned int getPing(unsigned int clientID); 73 double getPacketLoss(unsigned int clientID); 72 74 protected: 73 75 void processQueue();
Note: See TracChangeset
for help on using the changeset viewer.