From 3dfe7043bad0d1e15fae0a5d29a191de2baccb26 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Mon, 7 Nov 2005 16:53:35 +0000 Subject: [PATCH] try INADD_NONE based UDP "disconnect" on various OS --- src/rsrv/online_notify.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/rsrv/online_notify.c b/src/rsrv/online_notify.c index 6e9ad94ec..4f57a9254 100644 --- a/src/rsrv/online_notify.c +++ b/src/rsrv/online_notify.c @@ -263,18 +263,16 @@ void rsrv_online_notify_task(void *pParm) { /* - * disconnect so that bogus messages arriving at the ephemeral port - * do not consume resources - */ + * Connect to INADDR_NONE because a UDP connect to AF_UNSPEC + * only works with modern IP kernel. + * INADDR_NONE can never be a source address and therefore no + * messages can be received. + */ osiSockAddr sockAddr; memset ( &sockAddr, 0, sizeof ( sockAddr ) ); - /* - * connect to INADDR_LOOPBACK and port 0 because - * connect to AF_UNSPEC only works with modern IP kernel - */ sockAddr.ia.sin_family = AF_INET; - sockAddr.ia.sin_addr.s_addr = INADDR_LOOPBACK; - sockAddr.ia.sin_port = 0; + sockAddr.ia.sin_addr.s_addr = INADDR_NONE; + sockAddr.ia.sin_port = htons ( port ); status = connect ( sock, & sockAddr.sa, sizeof ( sockAddr.sa ) ); if ( status < 0 ) {