Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
58 changes: 32 additions & 26 deletions rehlds/dedicated/src/sys_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,34 +146,40 @@ void alarmFunc(int num)

}

void Sleep_Pingboost4(int msec);

void Sys_InitPingboost()
{
Sys_Sleep = Sleep_Old;

char *pPingType;
if (CommandLine()->CheckParm("-pingboost", &pPingType) && pPingType) {
int type = Q_atoi(pPingType);
switch (type) {
case 1:
signal(SIGALRM, alarmFunc);
Sys_Sleep = Sleep_Timer;
break;
case 2:
Sys_Sleep = Sleep_Select;
break;
case 3:
Sys_Sleep = Sleep_Net;

// we Sys_GetProcAddress NET_Sleep() from
//engine_i486.so later in this function
NET_Sleep_Timeout = (NET_Sleep_t)Sys_GetProcAddress(g_pEngineModule, "NET_Sleep_Timeout");
break;
// just in case
default:
Sys_Sleep = Sleep_Old;
break;
}
}
Sys_Sleep = Sleep_Old;

char* pPingType;
if (CommandLine()->CheckParm("-pingboost", &pPingType) && pPingType) {
int type = Q_atoi(pPingType);
switch (type) {
case 1:
signal(SIGALRM, alarmFunc);
Sys_Sleep = Sleep_Timer;
break;
case 2:
Sys_Sleep = Sleep_Select;
break;
case 3:
Sys_Sleep = Sleep_Net;
NET_Sleep_Timeout = (NET_Sleep_t)Sys_GetProcAddress(g_pEngineModule, "NET_Sleep_Timeout");
cris840 marked this conversation as resolved.
Show resolved Hide resolved
break;
case 4: // New case for -pingboost 4
Sys_Sleep = Sleep_Pingboost4;
break;
default:
Sys_Sleep = Sleep_Old;
break;
}
}
}

void Sleep_Pingboost4(int msec)
cris840 marked this conversation as resolved.
Show resolved Hide resolved
{
// Do nothing, just return without sleep
}

void Sys_WriteProcessIdFile()
Expand Down