summaryrefslogtreecommitdiffstats
path: root/win/tclWinSock.c
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2001-12-13 18:07:13 (GMT)
committerandreas_kupries <akupries@shaw.ca>2001-12-13 18:07:13 (GMT)
commitcc4241f38dd2b3dadc31041553797b84bba2a4b6 (patch)
tree09cb9d50b0d6a9d4abb10bb87a226f63daec692d /win/tclWinSock.c
parent5dc0afab5ab64d3aa4e4c8f88cdd800d420dcd49 (diff)
downloadtcl-cc4241f38dd2b3dadc31041553797b84bba2a4b6.zip
tcl-cc4241f38dd2b3dadc31041553797b84bba2a4b6.tar.gz
tcl-cc4241f38dd2b3dadc31041553797b84bba2a4b6.tar.bz2
* win/tclWinSock.c (TcpGetOptionProc): Fix for tcl bug item
#478565 reported by an unknown person. Bypasses all calls to "gethostbyaddr" for address "0.0.0.0" to prevent delays on Win/NT.
Diffstat (limited to 'win/tclWinSock.c')
-rw-r--r--win/tclWinSock.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 42f647b..d68b4a2 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinSock.c,v 1.21 2001/09/20 18:33:37 hobbs Exp $
+ * RCS: @(#) $Id: tclWinSock.c,v 1.22 2001/12/13 18:07:13 andreas_kupries Exp $
*/
#include "tclWinInt.h"
@@ -1946,9 +1946,14 @@ TcpGetOptionProc(instanceData, interp, optionName, dsPtr)
}
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 @@ TcpGetOptionProc(instanceData, interp, optionName, dsPtr)
}
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 {