Changeset 7974 in orxonox.OLD for branches/network/src/lib
- Timestamp:
- May 30, 2006, 11:44:48 AM (19 years ago)
- Location:
- branches/network/src/lib/network
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/Makefile.am
r7954 r7974 23 23 network_log.cc \ 24 24 zip.cc \ 25 player_stats.cc \ 25 26 \ 26 27 synchronizeable_var/synchronizeable_var.cc \ … … 56 57 network_log.h \ 57 58 zip.h \ 59 player_stats.h \ 58 60 \ 59 61 synchronizeable_var/synchronizeable_var.h \ -
branches/network/src/lib/network/connection_monitor.cc
r7954 r7974 61 61 * @param stateId packet's state id 62 62 */ 63 void ConnectionMonitor::processUnzippedOutgoingPacket( byte * data, int length, int stateId ) 64 { 65 int tick = SDL_GetTicks(); 66 63 void ConnectionMonitor::processUnzippedOutgoingPacket( int tick, byte * data, int length, int stateId ) 64 { 67 65 nOutgoingPackets++; 68 66 … … 93 91 * @param ackedState state which was acked by this packet 94 92 */ 95 void ConnectionMonitor::processUnzippedIncomingPacket( byte * data, int length, int stateId, int ackedState ) 96 { 97 int tick = SDL_GetTicks(); 98 93 void ConnectionMonitor::processUnzippedIncomingPacket( int tick, byte * data, int length, int stateId, int ackedState ) 94 { 99 95 nIncomingPackets++; 100 96 … … 169 165 * @param stateId packet's state id 170 166 */ 171 void ConnectionMonitor::processZippedOutgoingPacket( byte * data, int length, int stateId ) 172 { 173 int tick = SDL_GetTicks(); 174 167 void ConnectionMonitor::processZippedOutgoingPacket( int tick, byte * data, int length, int stateId ) 168 { 175 169 nZOutgoingPackets++; 176 170 … … 196 190 * @param ackedState state which was acked by this packet 197 191 */ 198 void ConnectionMonitor::processZippedIncomingPacket( byte * data, int length, int stateId, int ackedState ) 199 { 200 int tick = SDL_GetTicks(); 201 192 void ConnectionMonitor::processZippedIncomingPacket( int tick, byte * data, int length ) 193 { 202 194 nZIncomingPackets++; 203 195 … … 233 225 void ConnectionMonitor::printStatis( ) 234 226 { 235 NETPRINT(n)("========= NETWORKSTATS FOR USER %d=========\n", userId);236 NETPRINT(n)("PING = %d\n", ping );227 NETPRINT(n)("============NETWORKSTATS FOR USER %d============\n", userId); 228 NETPRINT(n)("PING = %d\n", ping ); 237 229 NETPRINT(n)("BANDWIDTH: UP: %f (%f) DOWN %f (%f)\n", outgoingZippedBandWidth, outgoingUnzippedBandWidth, incomingZippedBandWidth, incomingUnzippedBandWidth); 238 NETPRINT(n)("=========================================="); 239 } 240 241 230 NETPRINT(n)("PACKETS: RECIEVED %d; SENT %d\n", nIncomingPackets, nOutgoingPackets ); 231 NETPRINT(n)("================================================\n"); 232 } 233 234 -
branches/network/src/lib/network/connection_monitor.h
r7954 r7974 22 22 virtual ~ConnectionMonitor(); 23 23 24 void processUnzippedOutgoingPacket( byte * data, int length, int stateId );25 void processUnzippedIncomingPacket( byte * data, int length, int stateId, int ackedState );24 void processUnzippedOutgoingPacket( int tick, byte * data, int length, int stateId ); 25 void processUnzippedIncomingPacket( int tick, byte * data, int length, int stateId, int ackedState ); 26 26 27 void processZippedOutgoingPacket( byte * data, int length, int stateId );28 void processZippedIncomingPacket( byte * data, int length, int stateId, int ackedState);27 void processZippedOutgoingPacket( int tick, byte * data, int length, int stateId ); 28 void processZippedIncomingPacket( int tick, byte * data, int length ); 29 29 30 30 void calculatePing(); -
branches/network/src/lib/network/network_stream.cc
r7954 r7974 177 177 void NetworkStream::processData() 178 178 { 179 int tick = SDL_GetTicks(); 180 179 181 currentState++; 180 182 … … 207 209 // order of up/downstream is important!!!! 208 210 // don't change it 209 handleDownstream( );210 handleUpstream( );211 handleDownstream( tick ); 212 handleUpstream( tick ); 211 213 212 214 } … … 391 393 * handle upstream network traffic 392 394 */ 393 void NetworkStream::handleUpstream( )395 void NetworkStream::handleUpstream( int tick ) 394 396 { 395 397 int offset; 396 398 int n; 397 399 398 for ( PeerList:: iterator peer = peers.begin(); peer != peers.end(); peer++ )400 for ( PeerList::reverse_iterator peer = peers.rbegin(); peer != peers.rend(); peer++ ) 399 401 { 400 402 offset = INTSIZE; //make already space for length … … 496 498 writeToNewDict( buf, offset ); 497 499 498 peer->second.connectionMonitor->processUnzippedOutgoingPacket( buf, offset, currentState );499 peer->second.connectionMonitor->processZippedOutgoingPacket( compBuf, compLength, currentState );500 peer->second.connectionMonitor->processUnzippedOutgoingPacket( tick, buf, offset, currentState ); 501 peer->second.connectionMonitor->processZippedOutgoingPacket( tick, compBuf, compLength, currentState ); 500 502 501 503 //NETPRINTF(n)("send packet: %d userId = %d\n", offset, peer->second.userId); … … 506 508 * handle downstream network traffic 507 509 */ 508 void NetworkStream::handleDownstream( )510 void NetworkStream::handleDownstream( int tick ) 509 511 { 510 512 int offset = 0; … … 527 529 while ( 0 < (compLength = peer->second.socket->readPacket( compBuf, UDP_PACKET_SIZE )) ) 528 530 { 529 //TODO tell monitor about zipped packet. because dropped packets dont count to bandwidth 531 peer->second.connectionMonitor->processZippedIncomingPacket( tick, compBuf, compLength ); 532 530 533 //PRINTF(0)("GGGGGOOOOOOOOOOTTTTTTTT: %d\n", compLength); 531 534 packetLength = Zip::getInstance()->unZip( compBuf, compLength, buf, UDP_PACKET_SIZE ); … … 547 550 //NETPRINTF(n)("ackedstate: %d\n", ackedState); 548 551 offset = 4*INTSIZE; 552 553 peer->second.connectionMonitor->processUnzippedIncomingPacket( tick, buf, offset, state, ackedState ); 549 554 550 555 //NETPRINTF(n)("got packet: %d, %d\n", length, packetLength); … … 672 677 } 673 678 674 peer->second.connectionMonitor->processZippedIncomingPacket( compBuf, compLength, state, ackedState );675 peer->second.connectionMonitor->processUnzippedIncomingPacket( buf, offset, state, ackedState );676 677 679 assert( peer->second.lastAckedState <= ackedState ); 678 680 peer->second.lastAckedState = ackedState; -
branches/network/src/lib/network/network_stream.h
r7954 r7974 79 79 void updateConnectionList(); 80 80 void handleHandshakes(); 81 void handleUpstream( );82 void handleDownstream( );81 void handleUpstream( int tick ); 82 void handleDownstream(int tick ); 83 83 void handleNewClient( int userId ); 84 84 void cleanUpOldSyncList(); -
branches/network/src/lib/network/synchronizeable.h
r7954 r7974 61 61 virtual void handleSentState( int userId, int stateId, int fromStateId ); 62 62 virtual void handleRecvState( int userId, int stateId, int fromStateId ); 63 63 64 64 void registerVar( SynchronizeableVar * var ); 65 65 int registerVarId( SynchronizeableVar * var );
Note: See TracChangeset
for help on using the changeset viewer.