engine: server: set flag that we are expecting resource list to come from the client to not apply resource list rate limit

This commit is contained in:
Alibek Omarov
2026-06-02 02:56:19 +05:00
parent 4a2c218cfc
commit 47582182e6
3 changed files with 16 additions and 6 deletions

View File

@@ -73,6 +73,7 @@ extern int SV_UPDATE_BACKUP;
#define FCL_HLTV_PROXY BIT( 8 ) // this is a proxy for a HLTV client (spectator)
#define FCL_SEND_RESOURCES BIT( 9 )
#define FCL_FORCE_UNMODIFIED BIT( 10 )
#define FCL_EXPECT_RESOURCELIST BIT( 11 ) // engine sent svc_resourcerequest, expect one clc_resourcelist in response
typedef enum
{

View File

@@ -3485,15 +3485,22 @@ static void SV_ParseResourceList( sv_client_t *cl, sizebuf_t *msg )
SV_AddToResourceList( resource, &cl->resourcesneeded );
}
if( host.realtime < cl->resourcelist_next_changetime )
if( FBitSet( cl->flags, FCL_EXPECT_RESOURCELIST ))
{
Con_Reportf( "%s: ignoring resource list update from %s: too soon\n", __func__, cl->name );
SV_ClearResourceList( &cl->resourcesneeded );
SV_ClearResourceList( &cl->resourcesonhand );
return;
ClearBits( cl->flags, FCL_EXPECT_RESOURCELIST );
}
else
{
if( host.realtime < cl->resourcelist_next_changetime )
{
Con_Reportf( "%s: ignoring resource list update from %s: too soon\n", __func__, cl->name );
SV_ClearResourceList( &cl->resourcesneeded );
SV_ClearResourceList( &cl->resourcesonhand );
return;
}
cl->resourcelist_next_changetime = host.realtime + sv_upload_penalty_time.value;
cl->resourcelist_next_changetime = host.realtime + sv_upload_penalty_time.value;
}
totalsize = COM_SizeofResourceList( &cl->resourcesneeded, &ri );

View File

@@ -543,6 +543,8 @@ void SV_SendResource( resource_t *pResource, sizebuf_t *msg )
void SV_SendResources( sv_client_t *cl, sizebuf_t *msg )
{
SetBits( cl->flags, FCL_EXPECT_RESOURCELIST );
MSG_BeginServerCmd( msg, svc_resourcerequest );
MSG_WriteLong( msg, svs.spawncount );
MSG_WriteLong( msg, 0 );