mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-12 08:08:02 +00:00
engine: client: remove master server queries from NetAPI, they are never used by mods
This commit is contained in:
parent
a1ab84a2ca
commit
0330569537
@ -3336,6 +3336,9 @@ static void GAME_EXPORT NetAPI_SendRequest( int context, int request, int flags,
|
||||
if( remote_address->type != NA_IPX && remote_address->type != NA_BROADCAST_IPX )
|
||||
return; // IPX no longer support
|
||||
|
||||
if( request == NETAPI_REQUEST_SERVERLIST )
|
||||
return; // no support for server list requests
|
||||
|
||||
// find a free request
|
||||
for( i = 0; i < MAX_REQUESTS; i++ )
|
||||
{
|
||||
@ -3372,28 +3375,9 @@ static void GAME_EXPORT NetAPI_SendRequest( int context, int request, int flags,
|
||||
nr->resp.remote_address = *remote_address;
|
||||
nr->flags = flags;
|
||||
|
||||
if( request == NETAPI_REQUEST_SERVERLIST )
|
||||
{
|
||||
char fullquery[512];
|
||||
size_t len;
|
||||
|
||||
len = CL_BuildMasterServerScanRequest( fullquery, sizeof( fullquery ), false );
|
||||
|
||||
// make sure that port is specified
|
||||
if( !nr->resp.remote_address.port )
|
||||
nr->resp.remote_address.port = MSG_BigShort( PORT_MASTER );
|
||||
|
||||
// grab the list from the master server
|
||||
NET_SendPacket( NS_CLIENT, len, fullquery, nr->resp.remote_address );
|
||||
clgame.request_type = NET_REQUEST_CLIENT;
|
||||
clgame.master_request = nr; // holds the master request unitl the master acking
|
||||
}
|
||||
else
|
||||
{
|
||||
// local servers request
|
||||
Q_snprintf( req, sizeof( req ), "netinfo %i %i %i", PROTOCOL_VERSION, context, request );
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, nr->resp.remote_address, "%s", req );
|
||||
}
|
||||
// local servers request
|
||||
Q_snprintf( req, sizeof( req ), "netinfo %i %i %i", PROTOCOL_VERSION, context, request );
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, nr->resp.remote_address, "%s", req );
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3421,13 +3405,6 @@ static void GAME_EXPORT NetAPI_CancelRequest( int context )
|
||||
nr->pfnFunc( &nr->resp );
|
||||
}
|
||||
|
||||
if( clgame.net_requests[i].resp.type == NETAPI_REQUEST_SERVERLIST && &clgame.net_requests[i] == clgame.master_request )
|
||||
{
|
||||
if( clgame.request_type == NET_REQUEST_CLIENT )
|
||||
clgame.request_type = NET_REQUEST_CANCEL;
|
||||
clgame.master_request = NULL;
|
||||
}
|
||||
|
||||
memset( &clgame.net_requests[i], 0, sizeof( net_request_t ));
|
||||
break;
|
||||
}
|
||||
@ -3456,8 +3433,6 @@ void GAME_EXPORT NetAPI_CancelAllRequests( void )
|
||||
}
|
||||
|
||||
memset( clgame.net_requests, 0, sizeof( clgame.net_requests ));
|
||||
clgame.request_type = NET_REQUEST_CANCEL;
|
||||
clgame.master_request = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1617,14 +1617,6 @@ void CL_InternetServers_f( void )
|
||||
|
||||
cls.internetservers_wait = NET_SendToMasters( NS_CLIENT, len, fullquery );
|
||||
cls.internetservers_pending = true;
|
||||
|
||||
if( !cls.internetservers_wait )
|
||||
{
|
||||
// now we clearing the vgui request
|
||||
if( clgame.master_request != NULL )
|
||||
memset( clgame.master_request, 0, sizeof( net_request_t ));
|
||||
clgame.request_type = NET_REQUEST_GAMEUI;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2161,58 +2153,10 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
|
||||
// list is ends here
|
||||
if( !servadr.port )
|
||||
{
|
||||
if( clgame.request_type == NET_REQUEST_CLIENT && clgame.master_request != NULL )
|
||||
{
|
||||
net_request_t *nr = clgame.master_request;
|
||||
net_adrlist_t *list, **prev;
|
||||
|
||||
// setup the answer
|
||||
nr->resp.remote_address = from;
|
||||
nr->resp.error = NET_SUCCESS;
|
||||
nr->resp.ping = host.realtime - nr->timesend;
|
||||
|
||||
if( nr->timeout <= host.realtime )
|
||||
SetBits( nr->resp.error, NET_ERROR_TIMEOUT );
|
||||
|
||||
Con_Printf( "serverlist call: %s\n", NET_AdrToString( from ));
|
||||
nr->pfnFunc( &nr->resp );
|
||||
|
||||
// throw the list, now it will be stored in user area
|
||||
prev = (net_adrlist_t**)&nr->resp.response;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
list = *prev;
|
||||
if( !list ) break;
|
||||
|
||||
// throw out any variables the game created
|
||||
*prev = list->next;
|
||||
Mem_Free( list );
|
||||
}
|
||||
memset( nr, 0, sizeof( *nr )); // done
|
||||
clgame.request_type = NET_REQUEST_CANCEL;
|
||||
clgame.master_request = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if( clgame.request_type == NET_REQUEST_CLIENT && clgame.master_request != NULL )
|
||||
{
|
||||
net_request_t *nr = clgame.master_request;
|
||||
net_adrlist_t *list;
|
||||
|
||||
// adding addresses into list
|
||||
list = Z_Malloc( sizeof( *list ));
|
||||
list->remote_address = servadr;
|
||||
list->next = nr->resp.response;
|
||||
nr->resp.response = list;
|
||||
}
|
||||
else if( clgame.request_type == NET_REQUEST_GAMEUI )
|
||||
{
|
||||
NET_Config( true, false ); // allow remote
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, servadr, "info %i", PROTOCOL_VERSION );
|
||||
}
|
||||
NET_Config( true, false ); // allow remote
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, servadr, "info %i", PROTOCOL_VERSION );
|
||||
}
|
||||
|
||||
if( cls.internetservers_pending )
|
||||
|
@ -423,13 +423,6 @@ typedef struct
|
||||
float applied_angle;
|
||||
} screen_shake_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NET_REQUEST_CANCEL = 0, // request was cancelled for some reasons
|
||||
NET_REQUEST_GAMEUI, // called from GameUI
|
||||
NET_REQUEST_CLIENT, // called from Client
|
||||
} net_request_type_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
net_response_t resp;
|
||||
@ -491,9 +484,7 @@ typedef struct
|
||||
client_textmessage_t *titles; // title messages, not network messages
|
||||
int numTitles;
|
||||
|
||||
net_request_type_t request_type; // filter the requests
|
||||
net_request_t net_requests[MAX_REQUESTS]; // no reason to keep more
|
||||
net_request_t *master_request; // queued master request
|
||||
|
||||
efrag_t *free_efrags; // linked efrags
|
||||
cl_entity_t viewent; // viewmodel
|
||||
|
Loading…
Reference in New Issue
Block a user