From ce070000549db111987b966b47c9d3a570cc8d4f Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 22 Aug 2011 10:30:35 +0900 Subject: [PATCH] Make the address comparison a little more informative. Still hunting the openbsd connection issues. It seems the address comparision isn't working. --- include/net_udp.h | 4 +++- libs/net/nm/net_dgrm.c | 2 ++ libs/net/nm/net_udp.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/net_udp.h b/include/net_udp.h index 79690f3cd..b85d69000 100644 --- a/include/net_udp.h +++ b/include/net_udp.h @@ -170,7 +170,9 @@ int UDP_GetAddrFromName (const char *name, struct qsockaddr *addr); \param addr1 The first address to compare. \param addr2 The second address to compare. - \return -1 if the family or address are different. + \return -2 if the family is different. + \return -1 if the family is the same, but the address is + different. \return 1 if the family and address are the same, but the port is different. \return 0 if everything is the same. diff --git a/libs/net/nm/net_dgrm.c b/libs/net/nm/net_dgrm.c index 732fa7c90..a4f482893 100644 --- a/libs/net/nm/net_dgrm.c +++ b/libs/net/nm/net_dgrm.c @@ -1273,6 +1273,8 @@ _Datagram_Connect (const char *host) if (ret > 0) { // is it from the right place? if (sfunc.AddrCompare (&readaddr, &sendaddr) != 0) { + Sys_MaskPrintf (SYS_NET, "%2d ", + sfunc.AddrCompare (&readaddr, &sendaddr)); Sys_MaskPrintf (SYS_NET, "%s ", sfunc.AddrToString (&readaddr)); Sys_MaskPrintf (SYS_NET, "%s\n", diff --git a/libs/net/nm/net_udp.c b/libs/net/nm/net_udp.c index 19525a963..8166b33b5 100644 --- a/libs/net/nm/net_udp.c +++ b/libs/net/nm/net_udp.c @@ -573,7 +573,7 @@ int UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2) { if (addr1->qsa_family != addr2->qsa_family) - return -1; + return -2; if (((struct sockaddr_in *) addr1)->sin_addr.s_addr != ((struct sockaddr_in *) addr2)->sin_addr.s_addr)