2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-03-12 13:30:22 +03:00

Implement -pingboost 4 for behavior similar to mm_insane 1 in Linux

Implemented the Sleep_Pingboost4 function to achieve similar behavior to mm_insane 1 of the mmtimer metamod, since the function does not perform any further action, sleep is removed.
This commit is contained in:
Cris 2023-07-01 15:19:31 -05:00
parent a680f18ee1
commit 0d7726e8a4

View File

@ -146,34 +146,40 @@ void alarmFunc(int num)
} }
void Sleep_Pingboost4(int msec);
void Sys_InitPingboost() void Sys_InitPingboost()
{ {
Sys_Sleep = Sleep_Old; Sys_Sleep = Sleep_Old;
char *pPingType; char* pPingType;
if (CommandLine()->CheckParm("-pingboost", &pPingType) && pPingType) { if (CommandLine()->CheckParm("-pingboost", &pPingType) && pPingType) {
int type = Q_atoi(pPingType); int type = Q_atoi(pPingType);
switch (type) { switch (type) {
case 1: case 1:
signal(SIGALRM, alarmFunc); signal(SIGALRM, alarmFunc);
Sys_Sleep = Sleep_Timer; Sys_Sleep = Sleep_Timer;
break; break;
case 2: case 2:
Sys_Sleep = Sleep_Select; Sys_Sleep = Sleep_Select;
break; break;
case 3: case 3:
Sys_Sleep = Sleep_Net; Sys_Sleep = Sleep_Net;
NET_Sleep_Timeout = (NET_Sleep_t)Sys_GetProcAddress(g_pEngineModule, "NET_Sleep_Timeout");
break;
case 4: // New case for -pingboost 4
Sys_Sleep = Sleep_Pingboost4;
break;
default:
Sys_Sleep = Sleep_Old;
break;
}
}
}
// we Sys_GetProcAddress NET_Sleep() from void Sleep_Pingboost4(int msec)
//engine_i486.so later in this function {
NET_Sleep_Timeout = (NET_Sleep_t)Sys_GetProcAddress(g_pEngineModule, "NET_Sleep_Timeout"); // Do nothing, just return without sleep
break;
// just in case
default:
Sys_Sleep = Sleep_Old;
break;
}
}
} }
void Sys_WriteProcessIdFile() void Sys_WriteProcessIdFile()