From 712c1e2f95fce21b4966ba2af7c0c4e6d52ea812 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 4 Oct 2025 00:14:58 +0500 Subject: [PATCH] engine: fix send state of master servers being cleared twice --- engine/common/masterlist.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/engine/common/masterlist.c b/engine/common/masterlist.c index 67b3f4d5..42d827a6 100644 --- a/engine/common/masterlist.c +++ b/engine/common/masterlist.c @@ -96,6 +96,13 @@ static net_gai_state_t NET_GetMasterHostByName( master_t *m ) return res; } +static void NET_ClearSendState( void ) +{ + // reset sent state + for( master_t *master = ml.head; master; master = master->next ) + master->sent = false; +} + /* ======================== NET_SendToMasters @@ -141,13 +148,6 @@ static qboolean NET_SendToMasters( netsrc_t sock, size_t len, const void *data, } } - if( !wait ) - { - // reset sent state - for( master = ml.head; master; master = master->next ) - master->sent = false; - } - return wait; } @@ -212,6 +212,9 @@ qboolean NET_MasterQuery( uint32_t key, qboolean nat, const char *filter ) wait = NET_SendToMasters( NS_CLIENT, len, buf, PROTO_GOLDSRC ); } + if( !wait ) + NET_ClearSendState(); + return wait; } @@ -267,6 +270,7 @@ void NET_MasterShutdown( void ) { NET_Config( true, false ); // allow remote while( NET_SendToMasters( NS_SERVER, 2, "\x62\x0A", PROTO_CURRENT )); + NET_ClearSendState(); }