Update of /cvsroot/naviserver/naviserver/nsd
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1156/nsd
Modified Files:
binder.c
Log Message:
Index: binder.c
===================================================================
RCS file: /cvsroot/naviserver/naviserver/nsd/binder.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** binder.c 3 Nov 2005 07:15:09 -0000 1.16
--- binder.c 3 Nov 2005 16:17:46 -0000 1.17
***************
*** 132,135 ****
--- 132,144 ----
}
+ /*
+ * If forked binder is running and we could not allocate socket
+ * directly, try to do it through the binder
+ */
+
+ if (sock == -1 && binderRunning) {
+ sock = Ns_SockBinderListen('T', address, port, backlog);
+ }
+
return (SOCKET)sock;
}
***************
*** 173,176 ****
--- 182,193 ----
}
+ /*
+ * If forked binder is running and we could not allocate socket
+ * directly, try to do it through the binder
+ */
+
+ if (sock == -1 && binderRunning) {
+ sock = Ns_SockBinderListen('U', address, port, 0);
+ }
return (SOCKET)sock;
}
***************
*** 216,219 ****
--- 233,245 ----
}
+ /*
+ * If forked binder is running and we could not allocate socket
+ * directly, try to do it through the binder
+ */
+
+ if (sock == -1 && binderRunning) {
+ sock = Ns_SockBinderListen('R', 0, proto, proto);
+ }
+
return (SOCKET)sock;
}
***************
*** 267,270 ****
--- 293,305 ----
Ns_SetSockErrno(err);
}
+
+ /*
+ * If forked binder is running and we could not allocate socket
+ * directly, try to do it through the binder
+ */
+
+ if (sock == -1 && binderRunning) {
+ sock = Ns_SockBinderListen('D', path, 0, backlog);
+ }
#endif
***************
*** 440,444 ****
Tcl_Channel chan = Tcl_OpenFileChannel(NULL, file, "r", 0);
if (chan == NULL) {
! Ns_Log(Error, "binder: can't open file '%s': '%s'", file,
strerror(Tcl_GetErrno()));
} else {
--- 475,479 ----
Tcl_Channel chan = Tcl_OpenFileChannel(NULL, file, "r", 0);
if (chan == NULL) {
! Ns_Log(Error, "NsPreBind: can't open file '%s': '%s'", file,
strerror(Tcl_GetErrno()));
} else {
***************
*** 807,813 ****
sock = -1;
}
- if (address == NULL) {
- address = "0.0.0.0";
- }
if (err == 0) {
Ns_Log(Notice, "Ns_SockBinderListen: listen(%s,%d) = %d",
--- 842,845 ----
***************
*** 853,857 ****
if (ns_sockpair(binderRequest) != 0 || ns_sockpair(binderResponse) != 0) {
! Ns_Fatal("binder: ns_sockpair() failed: '%s'", strerror(errno));
}
--- 885,889 ----
if (ns_sockpair(binderRequest) != 0 || ns_sockpair(binderResponse) != 0) {
! Ns_Fatal("NsForkBinder: ns_sockpair() failed: '%s'", strerror(errno));
}
***************
*** 866,874 ****
pid = ns_fork();
if (pid < 0) {
! Ns_Fatal("binder: fork() failed: '%s'", strerror(errno));
} else if (pid == 0) {
pid = ns_fork();
if (pid < 0) {
! Ns_Fatal("binder: fork() failed: '%s'", strerror(errno));
} else if (pid == 0) {
close(binderRequest[1]);
--- 898,906 ----
pid = ns_fork();
if (pid < 0) {
! Ns_Fatal("NsForkBinder: fork() failed: '%s'", strerror(errno));
} else if (pid == 0) {
pid = ns_fork();
if (pid < 0) {
! Ns_Fatal("NsForkBinder: fork() failed: '%s'", strerror(errno));
} else if (pid == 0) {
close(binderRequest[1]);
***************
*** 879,886 ****
}
if (Ns_WaitForProcess(pid, &status) != NS_OK) {
! Ns_Fatal("binder: Ns_WaitForProcess(%d) failed: '%s'",
pid, strerror(errno));
} else if (status != 0) {
! Ns_Fatal("binder: process %d exited with non-zero status: %d",
pid, status);
}
--- 911,918 ----
}
if (Ns_WaitForProcess(pid, &status) != NS_OK) {
! Ns_Fatal("NsForkBinder: Ns_WaitForProcess(%d) failed: '%s'",
pid, strerror(errno));
} else if (status != 0) {
! Ns_Fatal("NsForkBinder: process %d exited with non-zero status: %d",
pid, status);
}
***************
*** 948,951 ****
--- 980,985 ----
#endif
+ Ns_Log(Notice, "binder: started");
+
/*
* Endlessly listen for socket bind requests.
***************
*** 1036,1038 ****
--- 1070,1073 ----
}
}
+ Ns_Log(Notice, "binder: stopped");
}
|