Fix cetus_reap related problems

This commit is contained in:
wangbin579 2018-07-25 15:52:09 +08:00
parent 2f2a9d69d0
commit bc5533b9c0
3 changed files with 9 additions and 0 deletions

View File

@ -119,6 +119,8 @@ cetus_master_process_cycle(cetus_cycle_t *cycle)
}
}
usleep(100 * 1000);
if (!cetus_terminate) {
chassis_event_loop_t *loop = cycle->event_base;
chassis_event_loop(loop);

View File

@ -372,6 +372,7 @@ cetus_signal_handler(int signo, siginfo_t *siginfo, void *ucontext)
break;
case SIGALRM:
g_message("%s: master received SIGALRM:%d", G_STRLOC, signo);
cetus_sigalrm = 1;
break;

View File

@ -53,6 +53,8 @@
#define E_NET_WOULDBLOCK EWOULDBLOCK
#endif
extern sig_atomic_t cetus_reap;
void
chassis_event_add_with_timeout(chassis *chas, struct event *ev, struct timeval *tv)
{
@ -95,6 +97,10 @@ chassis_event_loop(chassis_event_loop_t *loop)
* check once a second if we shall shutdown the proxy
*/
while (!chassis_is_shutdown()) {
if (cetus_reap) {
break;
}
struct timeval timeout;
int r;