$Log$
+ Revision 572.33 2000/08/31 23:02:15 ajc
+ * ig_tcp_server() and ig_uds_server() - check to make sure queue length is
+ always at least 5. Zero-length queues can cause connection lockups.
+
Revision 572.32 2000/08/31 21:32:44 ajc
* Still trying to fix a socket connect bug
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
-
#endif
#include <sys/types.h>
#include <dirent.h>
-#include <strings.h>
+#include <string.h>
#include <syslog.h>
#include <limits.h>
#include <ctype.h>
if (sockpath != NULL) {
newfcn->msock = ig_uds_server(sockpath, config.c_maxsessions);
- sprintf(message, "Unix domain socket %s: ", sockpath);
+ sprintf(message, "Unix domain socket '%s': ", sockpath);
}
else if (tcp_port <= 0) { /* port -1 to disable */
lprintf(7, "Service has been manually disabled, skipping\n");
{
struct sockaddr_in sin;
int s, i;
+ int actual_queue_len;
+
+ actual_queue_len = queue_len;
+ if (actual_queue_len < 5) actual_queue_len = 5;
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
return(-1);
}
- if (listen(s, queue_len) < 0) {
+ if (listen(s, actual_queue_len) < 0) {
lprintf(1, "citserver: Can't listen: %s\n", strerror(errno));
close(s);
return(-1);
struct sockaddr_un addr;
int s;
int i;
+ int actual_queue_len;
+
+ actual_queue_len = queue_len;
+ if (actual_queue_len < 5) actual_queue_len = 5;
i = unlink(sockpath);
if (i != 0) if (errno != ENOENT) {
return(-1);
}
- if (listen(s, queue_len) < 0) {
+ if (listen(s, actual_queue_len) < 0) {
lprintf(1, "citserver: Can't listen: %s\n", strerror(errno));
return(-1);
}
FD_ZERO(&masterfds);
masterhighest = 0;
+
lprintf(9, "Will listen on rescan pipe %d\n", rescan[0]);
FD_SET(rescan[0], &masterfds);
if (rescan[0] > masterhighest) masterhighest = rescan[0];
master_startup();
/*
- * Bind the server to our favorite ports.
+ * Bind the server to a Unix-domain socket.
*/
- CtdlRegisterServiceHook(0, /* Unix */
+ CtdlRegisterServiceHook(0,
"citadel.socket",
citproto_begin_session,
do_command_loop);
- CtdlRegisterServiceHook(config.c_port_number, /* TCP */
+
+ /*
+ * Bind the server to our favorite TCP port (usually 504).
+ */
+ CtdlRegisterServiceHook(config.c_port_number,
NULL,
citproto_begin_session,
do_command_loop);
*/
begin_critical_section(S_I_WANNA_SELECT);
-SETUP_FD: memcpy(&readfds, &masterfds, sizeof(fd_set) );
+SETUP_FD: memcpy(&readfds, &masterfds, sizeof masterfds);
highest = masterhighest;
begin_critical_section(S_SESSION_TABLE);
for (ptr = ContextList; ptr != NULL; ptr = ptr->next) {