X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=door_daemon%2Fdoor_daemon.c;h=0443910653b2402003915c584fe9cbd892dd63d2;hb=5cdaab19f6a0c16cbce882a16c987c5c33f4190d;hp=01bd6f3c15137e5818b9e1dcb3881c93f256fc1b;hpb=9903e31e3908087384637a11d3a297b878b4ba65;p=svn42.git diff --git a/door_daemon/door_daemon.c b/door_daemon/door_daemon.c index 01bd6f3..0443910 100644 --- a/door_daemon/door_daemon.c +++ b/door_daemon/door_daemon.c @@ -305,18 +305,29 @@ int main_loop(int door_fd, int cmd_listen_fd) FD_SET(sig_fd, &readfds); max_fd = (max_fd < sig_fd) ? sig_fd : max_fd; + struct timeval timeout; int return_value = 0; while(!return_value) { memcpy(&tmpfds, &readfds, sizeof(tmpfds)); - int ret = select(max_fd+1, &tmpfds, NULL, NULL, NULL); + timeout.tv_sec = 0; + timeout.tv_usec = 200000; + int ret = select(max_fd+1, &tmpfds, NULL, NULL, &timeout); if(ret == -1 && errno != EINTR) { log_printf(ERROR, "select returned with error: %s", strerror(errno)); return_value = -1; break; } - if(!ret || ret == -1) + if(ret == -1) continue; + if(!ret) { + if(cmd_q && cmd_has_expired(*cmd_q)) { + log_printf(ERROR, "last command expired"); + cmd_pop(&cmd_q); + } + else + continue; + } if(FD_ISSET(sig_fd, &tmpfds)) { if(signal_handle()) {