net_addr_comp_ip -> net_addr_comp_noport

This commit is contained in:
Learath 2018-10-08 19:56:51 +03:00
parent f1867e0403
commit 2e137e6fc7
3 changed files with 9 additions and 6 deletions

View file

@ -997,9 +997,12 @@ int net_addr_comp(const NETADDR *a, const NETADDR *b)
return mem_comp(a, b, sizeof(NETADDR));
}
int net_addr_comp_ip(const NETADDR *a, const NETADDR *b)
int net_addr_comp_noport(const NETADDR *a, const NETADDR *b)
{
return mem_comp(a->ip, b->ip, sizeof(a->ip));
NETADDR ta = *a, tb = *b;
ta.port = tb.port = 0;
return net_addr_comp(&ta, &tb);
}
void net_addr_str(const NETADDR *addr, char *string, int max_length, int add_port)

View file

@ -673,8 +673,8 @@ int net_host_lookup(const char *hostname, NETADDR *addr, int types);
int net_addr_comp(const NETADDR *a, const NETADDR *b);
/*
Function: net_addr_comp_ip
Compares two network addresses by ip.
Function: net_addr_comp_noport
Compares two network addresses ignoring port.
Parameters:
a - Address to compare
@ -685,7 +685,7 @@ int net_addr_comp(const NETADDR *a, const NETADDR *b);
0 - Address a is equal to address b
>0 - Address a is greater than address b
*/
int net_addr_comp_ip(const NETADDR *a, const NETADDR *b);
int net_addr_comp_noport(const NETADDR *a, const NETADDR *b);
/*
Function: net_addr_str

View file

@ -587,7 +587,7 @@ int CServer::DistinctClientCount()
ClientCount++;
for(int j = 0; j < MAX_CLIENTS; j++)
{
if(!net_addr_comp_ip(&aAddresses[i], &aAddresses[j]))
if(!net_addr_comp_noport(&aAddresses[i], &aAddresses[j]))
{
ClientCount--;
break;