Index: code/qcommon/common.c =================================================================== --- code/qcommon/common.c (revision 1753) +++ code/qcommon/common.c (working copy) @@ -3000,6 +3000,11 @@ lastTime = com_frameTime; // possible on first frame } msec = com_frameTime - lastTime; +#ifdef DEDICATED + // Avoid looping too quickly when no event is found + if (!msec && lastTime == com_frameTime) + Sys_Sleep(10); +#endif } while ( msec < minMsec ); Cbuf_Execute (); @@ -3061,10 +3066,6 @@ } CL_Frame( msec ); - - if ( com_speeds->integer ) { - timeAfter = Sys_Milliseconds (); - } #endif // @@ -3072,6 +3073,11 @@ // if ( com_speeds->integer ) { int all, sv, ev, cl; + timeAfter = Sys_Milliseconds (); +#ifdef DEDICATED + timeBeforeEvents = timeAfter; + timeBeforeClient = timeAfter; +#endif all = timeAfter - timeBeforeServer; sv = timeBeforeEvents - timeBeforeServer; Index: code/sys/con_tty.c =================================================================== --- code/sys/con_tty.c (revision 1753) +++ code/sys/con_tty.c (working copy) @@ -40,7 +40,11 @@ ============================================================= */ +#ifdef DEDICATED +qboolean stdin_active; +#else static qboolean stdin_active; +#endif // general flag to tell about tty console mode static qboolean ttycon_on = qfalse; static int ttycon_hide = 0; Index: code/sys/sys_unix.c =================================================================== --- code/sys/sys_unix.c (revision 1753) +++ code/sys/sys_unix.c (working copy) @@ -477,6 +477,16 @@ } else { +#ifdef DEDICATED + if (!stdin_active) { + struct timespec sleep; + struct timespec remain; + sleep.tv_sec = msec/1000; + sleep.tv_nsec = (msec%1000)*1000000; + nanosleep(&sleep,&remain); + return; + } +#endif struct timeval timeout; timeout.tv_sec = msec/1000; Index: code/sys/sys_local.h =================================================================== --- code/sys/sys_local.h (revision 1753) +++ code/sys/sys_local.h (working copy) @@ -39,6 +39,9 @@ void CON_Init( void ); char *CON_Input( void ); void CON_Print( const char *message ); +#ifdef DEDICATED +extern qboolean stdin_active; +#endif unsigned int CON_LogSize( void ); unsigned int CON_LogWrite( const char *in );