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))
|
if (IsFakeClient(client))
|
||||||
return;
|
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];
|
char sSteamID64[32];
|
||||||
SteamID32toSteamID64(sSteamID32, sSteamID64, sizeof(sSteamID64));
|
SteamID32toSteamID64(sSteamID32, sSteamID64, sizeof(sSteamID64));
|
||||||
|
|
||||||
@ -136,6 +159,8 @@ public void OnClientAuthorized(int client, const char[] sSteamID32)
|
|||||||
delete hRequest;
|
delete hRequest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
@ -177,6 +202,7 @@ public int OnClientAuthorized_OnTransferResponse(char[] sData, int iSerial)
|
|||||||
TrimString(sData);
|
TrimString(sData);
|
||||||
StripQuotes(sData);
|
StripQuotes(sData);
|
||||||
|
|
||||||
|
LogMessage("reached sData with status 200: %s", sData);
|
||||||
strcopy(G_sGroup[client], sizeof(G_sGroup[]), sData);
|
strcopy(G_sGroup[client], sizeof(G_sGroup[]), sData);
|
||||||
|
|
||||||
G_bResponsePassed[client] = true;
|
G_bResponsePassed[client] = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user