================== idAsyncServer::RunFrame ================== */
| 2350 | ================== |
| 2351 | */ |
| 2352 | void idAsyncServer::RunFrame( void ) { |
| 2353 | int i, msec, size; |
| 2354 | bool newPacket; |
| 2355 | idBitMsg msg; |
| 2356 | byte msgBuf[MAX_MESSAGE_SIZE]; |
| 2357 | netadr_t from; |
| 2358 | int outgoingRate, incomingRate; |
| 2359 | float outgoingCompression, incomingCompression; |
| 2360 | |
| 2361 | msec = UpdateTime( 100 ); |
| 2362 | |
| 2363 | if ( !serverPort.GetPort() ) { |
| 2364 | return; |
| 2365 | } |
| 2366 | |
| 2367 | if ( !active ) { |
| 2368 | ProcessConnectionLessMessages(); |
| 2369 | return; |
| 2370 | } |
| 2371 | |
| 2372 | gameTimeResidual += msec; |
| 2373 | |
| 2374 | // spin in place processing incoming packets until enough time lapsed to run a new game frame |
| 2375 | do { |
| 2376 | |
| 2377 | do { |
| 2378 | |
| 2379 | // blocking read with game time residual timeout |
| 2380 | newPacket = serverPort.GetPacketBlocking( from, msgBuf, size, sizeof( msgBuf ), USERCMD_MSEC - gameTimeResidual - 1 ); |
| 2381 | if ( newPacket ) { |
| 2382 | msg.Init( msgBuf, sizeof( msgBuf ) ); |
| 2383 | msg.SetSize( size ); |
| 2384 | msg.BeginReading(); |
| 2385 | if ( ProcessMessage( from, msg ) ) { |
| 2386 | return; // return because rcon was used |
| 2387 | } |
| 2388 | } |
| 2389 | |
| 2390 | msec = UpdateTime( 100 ); |
| 2391 | gameTimeResidual += msec; |
| 2392 | |
| 2393 | } while( newPacket ); |
| 2394 | |
| 2395 | } while( gameTimeResidual < USERCMD_MSEC ); |
| 2396 | |
| 2397 | // send heart beat to master servers |
| 2398 | MasterHeartbeat(); |
| 2399 | |
| 2400 | // check for clients that timed out |
| 2401 | CheckClientTimeouts(); |
| 2402 | |
| 2403 | if ( idAsyncNetwork::idleServer.GetBool() == ( !GetNumClients() || GetNumIdleClients() != GetNumClients() ) ) { |
| 2404 | idAsyncNetwork::idleServer.SetBool( !idAsyncNetwork::idleServer.GetBool() ); |
| 2405 | // the need to propagate right away, only this |
| 2406 | sessLocal.mapSpawnData.serverInfo.Set( "si_idleServer", idAsyncNetwork::idleServer.GetString() ); |
| 2407 | game->SetServerInfo( sessLocal.mapSpawnData.serverInfo ); |
| 2408 | } |
| 2409 |
nothing calls this directly
no test coverage detected