mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-27 02:57:22 +00:00
Fixed bug with HUP signal going into accept()
SVN revision: 1068
This commit is contained in:
parent
558e0f9d13
commit
44ac6754be
27
src/elogd.c
27
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.466 2004/09/09 19:35:34 midas
|
||||||
|
Fixed bug with HUP signal going into accept()
|
||||||
|
|
||||||
Revision 1.465 2004/09/08 14:41:23 midas
|
Revision 1.465 2004/09/08 14:41:23 midas
|
||||||
Fixed crash on deleting entries during synchronization
|
Fixed crash on deleting entries during synchronization
|
||||||
|
|
||||||
@ -19890,6 +19893,7 @@ void server_loop(void)
|
|||||||
if (_abort)
|
if (_abort)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (status == 0) { // if no HUP signal is received
|
||||||
if (FD_ISSET(lsock, &readfds)) {
|
if (FD_ISSET(lsock, &readfds)) {
|
||||||
len = sizeof(acc_addr);
|
len = sizeof(acc_addr);
|
||||||
_sock = accept(lsock, (struct sockaddr *) &acc_addr, &len);
|
_sock = accept(lsock, (struct sockaddr *) &acc_addr, &len);
|
||||||
@ -19908,9 +19912,9 @@ void server_loop(void)
|
|||||||
closesocket(ka_sock[i_min]);
|
closesocket(ka_sock[i_min]);
|
||||||
ka_sock[i_min] = 0;
|
ka_sock[i_min] = 0;
|
||||||
i = i_min;
|
i = i_min;
|
||||||
#ifdef DEBUG_CONN
|
#ifdef DEBUG_CONN
|
||||||
eprintf("## close connection %d\n", i_min);
|
eprintf("## close connection %d\n", i_min);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
i_conn = i;
|
i_conn = i;
|
||||||
@ -19925,9 +19929,9 @@ void server_loop(void)
|
|||||||
else
|
else
|
||||||
strcpy(remote_host[i_conn], (char *) inet_ntoa(rem_addr));
|
strcpy(remote_host[i_conn], (char *) inet_ntoa(rem_addr));
|
||||||
strcpy(rem_host, remote_host[i_conn]);
|
strcpy(rem_host, remote_host[i_conn]);
|
||||||
#ifdef DEBUG_CONN
|
#ifdef DEBUG_CONN
|
||||||
eprintf("## open new connection %d\n", i_conn);
|
eprintf("## open new connection %d\n", i_conn);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
@ -19943,9 +19947,9 @@ void server_loop(void)
|
|||||||
ka_time[i_conn] = (int) time(NULL);
|
ka_time[i_conn] = (int) time(NULL);
|
||||||
memcpy(&rem_addr, &remote_addr[i_conn], sizeof(rem_addr));
|
memcpy(&rem_addr, &remote_addr[i_conn], sizeof(rem_addr));
|
||||||
strcpy(rem_host, remote_host[i_conn]);
|
strcpy(rem_host, remote_host[i_conn]);
|
||||||
#ifdef DEBUG_CONN
|
#ifdef DEBUG_CONN
|
||||||
eprintf("## received request on connection %d\n", i_conn);
|
eprintf("## received request on connection %d\n", i_conn);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20190,11 +20194,11 @@ void server_loop(void)
|
|||||||
strlcpy(str, p, sizeof(str));
|
strlcpy(str, p, sizeof(str));
|
||||||
if (strchr(str, '\r'))
|
if (strchr(str, '\r'))
|
||||||
*strchr(str, '\r') = 0;
|
*strchr(str, '\r') = 0;
|
||||||
#ifdef OS_WINNT
|
#ifdef OS_WINNT
|
||||||
rem_addr.S_un.S_addr = inet_addr(str);
|
rem_addr.S_un.S_addr = inet_addr(str);
|
||||||
#else
|
#else
|
||||||
rem_addr.s_addr = inet_addr(str);
|
rem_addr.s_addr = inet_addr(str);
|
||||||
#endif
|
#endif
|
||||||
phe = gethostbyaddr((char *) &rem_addr, 4, PF_INET);
|
phe = gethostbyaddr((char *) &rem_addr, 4, PF_INET);
|
||||||
if (phe != NULL) {
|
if (phe != NULL) {
|
||||||
strcpy(remote_host[i_conn], phe->h_name);
|
strcpy(remote_host[i_conn], phe->h_name);
|
||||||
@ -20576,9 +20580,10 @@ void server_loop(void)
|
|||||||
if (!keep_alive) {
|
if (!keep_alive) {
|
||||||
closesocket(_sock);
|
closesocket(_sock);
|
||||||
ka_sock[i_conn] = 0;
|
ka_sock[i_conn] = 0;
|
||||||
#ifdef DEBUG_CONN
|
#ifdef DEBUG_CONN
|
||||||
eprintf("## close connection %d\n", i_conn);
|
eprintf("## close connection %d\n", i_conn);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user