Tcl Source Code

Artifact [2ccef7b202]
Login

Artifact 2ccef7b20223685c868f3050a9e9a17da5e0981c:

Attachment "478565.diff" to ticket [478565ffff] added by andreas_kupries 2001-12-12 02:20:06.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.750
diff -u -r1.750 ChangeLog
--- ChangeLog	2001/12/11 17:57:12	1.750
+++ ChangeLog	2001/12/11 19:17:37
@@ -1,3 +1,10 @@
+2001-12-11  Andreas Kupries  <[email protected]> 
+
+	* win/tclWinSock.c (TcpGetOptionProc): Fix for tcl bug item
+	  #478565 reported by an unknown person. Bypass all calls to
+	  "gethostbyaddr" for address "0.0.0.0" to prevent delays on
+	  Win/NT.
+
 2001-12-11  Miguel Sofer  <[email protected]>
 
 	* generic/tclExecute.c: fix debug messages in INST_LSET_LIST. 
Index: win/tclWinSock.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinSock.c,v
retrieving revision 1.21
diff -u -r1.21 tclWinSock.c
--- win/tclWinSock.c	2001/09/20 18:33:37	1.21
+++ win/tclWinSock.c	2001/12/11 19:17:38
@@ -1946,9 +1946,14 @@
             }
             Tcl_DStringAppendElement(dsPtr,
                     (*winSock.inet_ntoa)(peername.sin_addr));
-            hostEntPtr = (*winSock.gethostbyaddr)(
-                (char *) &(peername.sin_addr), sizeof(peername.sin_addr),
-                AF_INET);
+
+	    if (peername.sin_addr.s_addr == 0) {
+	        hostEntPtr = (struct hostent *) NULL;
+	    } else {
+	        hostEntPtr = (*winSock.gethostbyaddr)(
+                    (char *) &(peername.sin_addr), sizeof(peername.sin_addr),
+		    AF_INET);
+	    }
             if (hostEntPtr != (struct hostent *) NULL) {
                 Tcl_DStringAppendElement(dsPtr, hostEntPtr->h_name);
             } else {
@@ -1992,9 +1997,13 @@
             }
             Tcl_DStringAppendElement(dsPtr,
                     (*winSock.inet_ntoa)(sockname.sin_addr));
-            hostEntPtr = (*winSock.gethostbyaddr)(
-                (char *) &(sockname.sin_addr), sizeof(peername.sin_addr),
-                AF_INET);
+	    if (sockname.sin_addr.s_addr == 0) {
+	        hostEntPtr = (struct hostent *) NULL;
+	    } else {
+	        hostEntPtr = (*winSock.gethostbyaddr)(
+                    (char *) &(sockname.sin_addr), sizeof(peername.sin_addr),
+		    AF_INET);
+	    }
             if (hostEntPtr != (struct hostent *) NULL) {
                 Tcl_DStringAppendElement(dsPtr, hostEntPtr->h_name);
             } else {