|
|
@ -21,6 +21,7 @@ typedef struct master_s |
|
|
|
qboolean sent; |
|
|
|
qboolean sent; |
|
|
|
qboolean save; |
|
|
|
qboolean save; |
|
|
|
string address; |
|
|
|
string address; |
|
|
|
|
|
|
|
netadr_t adr; // temporary, rewritten after each send
|
|
|
|
} master_t; |
|
|
|
} master_t; |
|
|
|
|
|
|
|
|
|
|
|
struct masterlist_s |
|
|
|
struct masterlist_s |
|
|
@ -44,31 +45,32 @@ qboolean NET_SendToMasters( netsrc_t sock, size_t len, const void *data ) |
|
|
|
|
|
|
|
|
|
|
|
for( list = ml.list; list; list = list->next ) |
|
|
|
for( list = ml.list; list; list = list->next ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
netadr_t adr; |
|
|
|
|
|
|
|
int res; |
|
|
|
int res; |
|
|
|
|
|
|
|
|
|
|
|
if( list->sent ) |
|
|
|
if( list->sent ) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
res = NET_StringToAdrNB( list->address, &adr ); |
|
|
|
res = NET_StringToAdrNB( list->address, &list->adr ); |
|
|
|
|
|
|
|
|
|
|
|
if( !res ) |
|
|
|
if( !res ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Con_Reportf( "Can't resolve adr: %s\n", list->address ); |
|
|
|
Con_Reportf( "Can't resolve adr: %s\n", list->address ); |
|
|
|
list->sent = true; |
|
|
|
list->sent = true; |
|
|
|
|
|
|
|
list->adr.type = NA_UNUSED; |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( res == 2 ) |
|
|
|
if( res == 2 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
list->sent = false; |
|
|
|
list->sent = false; |
|
|
|
|
|
|
|
list->adr.type = NA_UNUSED; |
|
|
|
wait = true; |
|
|
|
wait = true; |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
list->sent = true; |
|
|
|
list->sent = true; |
|
|
|
|
|
|
|
|
|
|
|
NET_SendPacket( sock, len, data, adr ); |
|
|
|
NET_SendPacket( sock, len, data, list->adr ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( !wait ) |
|
|
|
if( !wait ) |
|
|
@ -85,6 +87,25 @@ qboolean NET_SendToMasters( netsrc_t sock, size_t len, const void *data ) |
|
|
|
return wait; |
|
|
|
return wait; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
======================== |
|
|
|
|
|
|
|
NET_IsMasterAdr |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
======================== |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
qboolean NET_IsMasterAdr( netadr_t adr ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
master_t *master; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for( master = ml.list; master; master = master->next ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( NET_CompareAdr( adr, master->adr )) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
======================== |
|
|
|
======================== |
|
|
|
NET_AddMaster |
|
|
|
NET_AddMaster |
|
|
@ -107,6 +128,7 @@ static void NET_AddMaster( const char *addr, qboolean save ) |
|
|
|
master->sent = false; |
|
|
|
master->sent = false; |
|
|
|
master->save = save; |
|
|
|
master->save = save; |
|
|
|
master->next = NULL; |
|
|
|
master->next = NULL; |
|
|
|
|
|
|
|
master->adr.type = NA_UNUSED; |
|
|
|
|
|
|
|
|
|
|
|
// link in
|
|
|
|
// link in
|
|
|
|
if( last ) |
|
|
|
if( last ) |
|
|
@ -161,7 +183,10 @@ static void NET_ListMasters_f( void ) |
|
|
|
|
|
|
|
|
|
|
|
for( i = 1, list = ml.list; list; i++, list = list->next ) |
|
|
|
for( i = 1, list = ml.list; list; i++, list = list->next ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Msg( "%d\t%s\n", i, list->address ); |
|
|
|
Msg( "%d\t%s", i, list->address ); |
|
|
|
|
|
|
|
if( list->adr.type != NA_UNUSED ) |
|
|
|
|
|
|
|
Msg( "\t%s\n", NET_AdrToString( list->adr )); |
|
|
|
|
|
|
|
else Msg( "\n" ); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|