added small delay to de-stress get requests spam for the VM or cloudflare if any suffer
This commit is contained in:
parent
0aaac71d5b
commit
609c46dfdb
@ -118,7 +118,30 @@ public void OnClientAuthorized(int client, const char[] sSteamID32)
|
||||
{
|
||||
if (IsFakeClient(client))
|
||||
return;
|
||||
DataPack hDataPack = new DataPack();
|
||||
hDataPack.WriteCell(client);
|
||||
hDataPack.WriteString(sSteamID32);
|
||||
float duration = GetRandomFloat(1.0, 2.5);
|
||||
CreateTimer(duration, Timer_do_https_request, hDataPack);
|
||||
}
|
||||
|
||||
stock bool IsValidClient(int client)
|
||||
{
|
||||
if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Action Timer_do_https_request(Handle timer, DataPack pack)
|
||||
{
|
||||
pack.Reset();
|
||||
int client = pack.ReadCell();
|
||||
if (IsValidClient(client))
|
||||
{
|
||||
char sSteamID32[32];
|
||||
pack.ReadString(sSteamID32, sizeof(sSteamID32));
|
||||
char sSteamID64[32];
|
||||
SteamID32toSteamID64(sSteamID32, sSteamID64, sizeof(sSteamID64));
|
||||
|
||||
@ -135,6 +158,8 @@ public void OnClientAuthorized(int client, const char[] sSteamID32)
|
||||
{
|
||||
delete hRequest;
|
||||
}
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -177,6 +202,7 @@ public int OnClientAuthorized_OnTransferResponse(char[] sData, int iSerial)
|
||||
TrimString(sData);
|
||||
StripQuotes(sData);
|
||||
|
||||
LogMessage("reached sData with status 200: %s", sData);
|
||||
strcopy(G_sGroup[client], sizeof(G_sGroup[]), sData);
|
||||
|
||||
G_bResponsePassed[client] = true;
|
||||
|
Loading…
Reference in New Issue
Block a user