> I've implemented it, and the patch is here:
>
> http://panoptic.com/aolserver/premature-prebound-closing-patch.txt
I've try it.
But Ns_SockListenEx() was called after executing NsClosePreBound().
Here is a patch for my testing:
--- nsd/binder.c~ Mon Feb 23 10:39:48 2004
+++ nsd/binder.c Mon Feb 23 10:50:35 2004
@@ -71,6 +71,7 @@
struct sockaddr_in sa;
Tcl_HashEntry *hPtr;
+ Ns_Log(Warning, "DEBUG: Called: Ns_SockListenEx(%s, %d, %d)", address, port,
backlog);
if (Ns_GetSockAddr(&sa, address, port) != NS_OK) {
return -1;
}
@@ -78,11 +79,13 @@
hPtr = Tcl_FindHashEntry(&prebound, (char *) &sa);
if (hPtr != NULL) {
sock = (int) Tcl_GetHashValue(hPtr);
+ Ns_Log(Warning, "DEBUG: Ns_SockListenEx() find socket %d in hash", sock);
Tcl_DeleteHashEntry(hPtr);
}
Ns_MutexUnlock(&lock);
if (hPtr == NULL) {
sock = Ns_SockBind(&sa);
+ Ns_Log(Warning, "DEBUG: Ns_SockListenEx() can not find socket in hash, so bind
%d", sock);
}
if (sock != -1 && listen(sock, backlog) != 0) {
err = errno;
@@ -90,6 +93,7 @@
errno = err;
sock = -1;
}
+ Ns_Log(Warning, "DEBUG: Ns_SockListenEx() return %d", sock);
return sock;
}
@@ -219,6 +223,7 @@
struct sockaddr_in sa;
char *err, *ent, *p, *q, *addr, *baddr;
+ Ns_Log(Warning, "DEBUG: Called: PreBind(%s)", line);
ent = line;
do {
p = strchr(ent, ',');
And here is a log:
[23/Feb/2004:10:53:02][67435.134557696][-main-] Notice: nsmain: AOLserver/4.1 running
[23/Feb/2004:10:53:02][67435.134557696][-main-] Notice: nsmain: security info: uid=80,
euid=80, gid=80, egid=80
[23/Feb/2004:10:53:02][67435.134559744][-sched-] Notice: sched: starting
[23/Feb/2004:10:53:02][67435.134557696][-main-] Notice: driver: starting: nssock
[23/Feb/2004:10:53:02][67435.134557696][-main-] Warning: driver: startup timeout:
nssock
[23/Feb/2004:10:53:02][67435.134557696][-main-] Warning: prebind: closed unused:
10.0.0.6:80 = 3
[23/Feb/2004:10:53:02][67435.134560768][-nssock:driver-] Notice: starting
[23/Feb/2004:10:53:02][67435.134560768][-nssock:driver-] Warning: DEBUG: Called:
Ns_SockListenEx(10.0.0.6, 80, 5)
[23/Feb/2004:10:53:02][67435.134560768][-nssock:driver-] Warning: DEBUG:
Ns_SockListenEx() can not find socket in hash, so bind -1
[23/Feb/2004:10:53:02][67435.134560768][-nssock:driver-] Warning: DEBUG:
Ns_SockListenEx() return -1
[23/Feb/2004:10:53:02][67435.134560768][-nssock:driver-] Fatal: nssock: failed to
listen on 10.0.0.6:80: Permission denied
Thanks.
--
T.Taguchi.
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of
your email blank.