engine: remove global no async resolve switch, platforms that do not support it shall add stubs to engine/platform

This commit is contained in:
Alibek Omarov
2025-09-29 00:12:37 +05:00
parent e83ab95279
commit 9aab12fc27
2 changed files with 1 additions and 22 deletions

View File

@@ -268,11 +268,6 @@ static qboolean NET_GetHostByName( const char *hostname, int family, struct sock
return ret;
}
#if !XASH_EMSCRIPTEN && !XASH_DOS4GW && !defined XASH_NO_ASYNC_NS_RESOLVE
#define CAN_ASYNC_NS_RESOLVE
#endif // !XASH_EMSCRIPTEN && !XASH_DOS4GW && !defined XASH_NO_ASYNC_NS_RESOLVE
#ifdef CAN_ASYNC_NS_RESOLVE
static void NET_ResolveThread( void );
#if XASH_SDL == 2
@@ -377,8 +372,6 @@ static void NET_ResolveThread( void )
mutex_unlock( nsthread.mutexres );
RESOLVE_DBG( "[resolve thread] exiting thread\n" );
}
#endif // CAN_ASYNC_NS_RESOLVE
/*
=============
@@ -436,7 +429,6 @@ net_gai_state_t NET_StringToSockaddr( const char *s, struct sockaddr_storage *sa
{
qboolean asyncfailed = true;
#ifdef CAN_ASYNC_NS_RESOLVE
if( net.threads_initialized && nonblocking )
{
mutex_lock( nsthread.mutexres );
@@ -478,7 +470,6 @@ net_gai_state_t NET_StringToSockaddr( const char *s, struct sockaddr_storage *sa
mutex_unlock( nsthread.mutexres );
}
#endif // CAN_ASYNC_NS_RESOLVE
if( asyncfailed )
ret = NET_GetHostByName( copy, family, &temp );
@@ -2061,9 +2052,7 @@ void NET_Init( void )
}
#endif
#ifdef CAN_ASYNC_NS_RESOLVE
NET_InitializeCriticalSections();
#endif
net.allow_ip = !Sys_CheckParm( "-noip" );
net.allow_ip6 = !Sys_CheckParm( "-noip6" );
@@ -2116,9 +2105,7 @@ void NET_Shutdown( void )
NET_Config( false, false );
#ifdef CAN_ASYNC_NS_RESOLVE
NET_DeleteCriticalSections();
#endif
#if XASH_WIN32
WSACleanup();

View File

@@ -90,8 +90,6 @@ def find_sdl(conf):
conf.env.XASH_SDL = 2
def configure(conf):
have_async_resolve = True
# Common dependencies, will be linked to both dedicated server and client
if conf.env.DEST_OS == 'linux':
conf.check_cc(lib='rt')
@@ -101,15 +99,11 @@ def configure(conf):
conf.env.LIB_HAIKU = ['network']
conf.env.LIBPATH_HAIKU = ['/boot/system/lib']
elif conf.env.DEST_OS == 'wasi':
have_async_resolve = False
conf.env.CFLAGS += ['-mllvm', '-wasm-enable-sjlj']
elif conf.env.DEST_OS == 'emscripten':
have_async_resolve = False
elif conf.env.DEST_OS == 'sunos':
conf.check_cc(lib='socket')
elif conf.env.DEST_OS == 'dos':
conf.options.STATIC = True
have_async_resolve = False
if conf.options.ENGINE_FUZZ:
conf.env.append_unique('CFLAGS', '-fsanitize=fuzzer-no-link')
@@ -136,7 +130,6 @@ def configure(conf):
elif conf.options.SDL12: # TODO: move to sdl2.py
conf.check_cfg(package='sdl', args='--cflags --libs', uselib_store='SDL1')
conf.env.XASH_SDL = 1
have_async_resolve = False
conf.env.HAVE_SDL1 = True
else:
find_sdl(conf)
@@ -146,7 +139,7 @@ def configure(conf):
conf.env.STATIC = True
conf.define('XASH_NO_LIBDL', 1)
if not conf.env.DEST_OS in ['win32', 'android'] and have_async_resolve:
if not conf.env.DEST_OS in ['win32', 'android']:
conf.check_pthreads(mode='c')
conf.check_cc(fragment=EXECINFO_TEST, msg='Checking for glibc backtrace()', mandatory=False, define_name='HAVE_EXECINFO')
@@ -187,7 +180,6 @@ def configure(conf):
conf.define_cond('XASH_STATIC_LIBS', conf.env.STATIC_LINKING)
conf.define_cond('XASH_CUSTOM_SWAP', conf.options.CUSTOM_SWAP)
conf.define_cond('XASH_NO_ASYNC_NS_RESOLVE', not have_async_resolve)
conf.define_cond('PSAPI_VERSION', conf.env.DEST_OS == 'win32') # will be defined as 1
for refdll in conf.refdlls: