mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Added periodic alarm to avoid blocking send()
This commit is contained in:
parent
2e365fffde
commit
ba71ce7427
16
src/elogd.c
16
src/elogd.c
@ -28492,6 +28492,12 @@ void hup_handler(int sig)
|
||||
_hup = TRUE;
|
||||
}
|
||||
|
||||
void alarm_handler(int sig)
|
||||
{
|
||||
if (sig)
|
||||
alarm(3);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
@ -28567,6 +28573,7 @@ void server_loop(void)
|
||||
struct sigaction ctrlc_handle;
|
||||
struct sigaction ignore_handle;
|
||||
struct sigaction hup_handle;
|
||||
struct sigaction alarm_handle;
|
||||
#endif
|
||||
|
||||
i_conn = content_length = 0;
|
||||
@ -28739,7 +28746,14 @@ void server_loop(void)
|
||||
sigemptyset(&hup_handle.sa_mask);
|
||||
hup_handle.sa_flags = 0;
|
||||
sigaction(SIGHUP, &hup_handle, NULL);
|
||||
|
||||
|
||||
alarm_handle.sa_handler = alarm_handler;
|
||||
sigemptyset(&alarm_handle.sa_mask);
|
||||
alarm_handle.sa_flags = 0;
|
||||
sigaction(SIGALRM, &alarm_handle, NULL);
|
||||
|
||||
alarm(3); // prevents blocking send() operations
|
||||
|
||||
/* give up root privilege */
|
||||
if (geteuid() == 0) {
|
||||
if (!getcfg("global", "Grp", str, sizeof(str)) || setegroup(str) < 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user