Mem_CheckSentinelsGlobal();
// if the accumulators haven't become positive yet, wait a while
- if(!sv_timer || !cl_timer)
- wait = min(cl_timer, sv_timer) * -1000000.0;
+ if (cls.state == ca_dedicated)
+ wait = sv_timer * -1000000.0; // dedicated
+ else if (!sv.active || svs.threaded)
+ wait = cl_timer * -1000000.0; // connected to server, main menu, or server is on different thread
else
- wait = max(cl_timer, sv_timer) * -1000000.0;
+ wait = max(cl_timer, sv_timer) * -1000000.0; // listen server or singleplayer
if (!host.restless && wait >= 1)
return wait;
time = 1; // because we cast to int
time0 = Sys_DirtyTime();
- if (sv_checkforpacketsduringsleep.integer && !sys_usenoclockbutbenchmark.integer && !svs.threaded)
- {
+ if (sv_checkforpacketsduringsleep.integer && !sys_usenoclockbutbenchmark.integer && !svs.threaded) {
NetConn_SleepMicroseconds((int)time);
if (cls.state != ca_dedicated)
NetConn_ClientFrame(); // helps server browser get good ping values
char vabuf[1024];
qbool playing = false;
- if(!sv.active)
- return 0;
-
if (!svs.threaded)
{
svs.perf_acc_sleeptime = host.sleeptime;
* Receive packets on each main loop iteration, as the main loop may
* be undersleeping due to select() detecting a new packet
*/
- NetConn_ServerFrame();
- SV_CheckTimeouts();
+ if (sv.active)
+ {
+ NetConn_ServerFrame();
+ SV_CheckTimeouts();
+ }
}
/*
sv_timer = 0.1;
}
- if (sv_timer > 0 && !svs.threaded)
+ if (sv.active && sv_timer > 0 && !svs.threaded)
{
/*
* Execute one or more server frames, with an upper limit on how much