Add network profiling tool from Spearhead and Breakthrough

Profiling can be enabled with `cl_netprofile` and `sv_netprofile`, the overlay can be shown using `cl_netprofileoverlay` and `sv_netprofileoverlay` and the server can dump network profile using the `netprofiledump` command
This commit is contained in:
smallmodel 2024-11-09 21:15:49 +01:00
parent 23a035e2ca
commit 1ef1bad9ae
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512
14 changed files with 871 additions and 66 deletions

View file

@ -382,7 +382,7 @@ void AuthenticateCallback(int gameid, int localid, int authenticated, char* errm
challenge->cdkeyState = 2;
challenge->pingTime = svs.time;
NET_OutOfBandPrint(NS_SERVER, challenge->adr, "challengeResponse %i", challenge->challenge);
SV_NET_OutOfBandPrint(&svs.netprofile, challenge->adr, "challengeResponse %i", challenge->challenge);
}
else
{
@ -396,7 +396,7 @@ void AuthenticateCallback(int gameid, int localid, int authenticated, char* errm
Com_Printf("%s failed cdkey authorization\n", buf);
challenge->cdkeyState = 3;
// tell the client about the reason
NET_OutOfBandPrint(NS_SERVER, challenge->adr, "droperror\nServer rejected connection:\n%s", errmsg);
SV_NET_OutOfBandPrint(&svs.netprofile, challenge->adr, "droperror\nServer rejected connection:\n%s", errmsg);
}
}
@ -437,18 +437,18 @@ void SV_GamespyAuthorize(netadr_t from, const char* response)
Com_DPrintf("authorize server timed out\n");
challenge->cdkeyState = CDKS_AUTHENTICATED;
challenge->pingTime = svs.time;
NET_OutOfBandPrint(NS_SERVER, from, "challengeResponse %i", challenge->challenge);
SV_NET_OutOfBandPrint(&svs.netprofile, from, "challengeResponse %i", challenge->challenge);
}
break;
case CDKS_AUTHENTICATED:
NET_OutOfBandPrint(NS_SERVER, from, "challengeResponse %i", challenge->challenge);
SV_NET_OutOfBandPrint(&svs.netprofile, from, "challengeResponse %i", challenge->challenge);
break;
case CDKS_FAILED:
// authentication server told the cdkey was invalid
Com_sprintf(buf, sizeof(buf), "%d.%d.%d.%d", challenge->adr.ip[0], challenge->adr.ip[1], challenge->adr.ip[2], challenge->adr.ip[3]);
Com_Printf("%s failed cdkey authorization\n", buf);
// reject the client
NET_OutOfBandPrint(NS_SERVER, from, "droperror\nServer rejected connection:\nInvalid CD Key");
SV_NET_OutOfBandPrint(&svs.netprofile, from, "droperror\nServer rejected connection:\nInvalid CD Key");
break;
default:
break;