From 10f164754d1792e9d9e6ebc60e90a89b5d8cd121 Mon Sep 17 00:00:00 2001 From: black Date: Tue, 28 Dec 2004 22:29:45 +0000 Subject: [PATCH] -Changed the name of PingTest to Test (it now also adds a name to the entry) -Now the test function is enabled by default (just so Vermeulen can play around with it) - there shouldnt be any conflicts with real servers since I shift the ping of all emulated servers by 250 ms. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4892 d7cf8633-e32d-0410-b094-e92efae38249 --- netconn.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/netconn.c b/netconn.c index e2d34910..e6dd8a77 100755 --- a/netconn.c +++ b/netconn.c @@ -170,9 +170,9 @@ static qboolean _hc_testint( int A, hostcache_maskop_t op, int B ) static qboolean _hc_teststr( const char *A, hostcache_maskop_t op, const char *B ) { if( op == HCMO_CONTAINS ) // A info B mask - return *A && !!strstr( B, A ); // we want a real bool + return *B && !!strstr( A, B ); // we want a real bool else if( op == HCMO_NOTCONTAIN ) - return !*A || !strstr( B, A ); + return !*B || !strstr( A, B ); else if( op == HCMO_LESS ) return strcmp( A, B ) < 0; else if( op == HCMO_LESSEQUAL ) @@ -292,6 +292,21 @@ void HostCache_ResetMasks(void) memset( &hostcache_ormasks, 0, sizeof( hostcache_ormasks ) ); } +#if 1 +static void _HostCache_Test(void) +{ + int i; + for( i = 0 ; i < 1024 ; i++ ) { + memset( &hostcache_cache[hostcache_cachecount], 0, sizeof( hostcache_t ) ); + hostcache_cache[hostcache_cachecount].info.ping = rand() % 450 + 250; + snprintf( hostcache_cache[hostcache_cachecount].info.name, 128, "Black's HostCache Test %i", i ); + hostcache_cache[hostcache_cachecount].finished = true; + sprintf( hostcache_cache[hostcache_cachecount].line1, "%i %s", hostcache_cache[hostcache_cachecount].info.ping, hostcache_cache[hostcache_cachecount].info.name ); + _HostCache_Insert( &hostcache_cache[hostcache_cachecount] ); + hostcache_cachecount++; + } +} +#endif void HostCache_QueryList(void) { @@ -305,24 +320,9 @@ void HostCache_QueryList(void) hostcache_consoleoutput = false; NetConn_QueryMasters(); - //_HostCache_PingTest(); + _HostCache_Test(); } -#if 0 -static void _HostCache_PingTest(void) -{ - int i; - for( i = 0 ; i < 50 ; i++ ) { - memset( &hostcache_cache[hostcache_cachecount], 0, sizeof( hostcache_t ) ); - hostcache_cache[hostcache_cachecount].info.ping = rand() % 450; - hostcache_cache[hostcache_cachecount].finished = true; - sprintf( hostcache_cache[hostcache_cachecount].line1, "%i", hostcache_cache[hostcache_cachecount].info.ping ); - _HostCache_Insert( &hostcache_cache[hostcache_cachecount] ); - hostcache_cachecount++; - } -} -#endif - // rest int NetConn_Read(lhnetsocket_t *mysocket, void *data, int maxlength, lhnetaddress_t *peeraddress) -- 2.39.2