From 08fca4477cf525cada8c66d309ea1daa2eac88b2 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 12 Oct 2009 17:10:04 +0200 Subject: re-enabled input thread termination handling that does avoid thread cancellation ...where possible. This provides a more reliable mode of rsyslogd termination (canceling threads my result in not properly freed resouces and potential later hangs, even though we perform proper cancel handling in our code). This is part of an effort to reduce thread cnacellation as much as possible in rsyslog. NOTE: some comments indicated that there were problems with some code that has been re-activated. Testing did not show any issues. My current assumption is that these issues were related to some other code that has been removed/changed during the previous restructuring events. In any case, if there is a shutdown issue, one should carefully look at this change here! --- plugins/imudp/imudp.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugins/imudp') diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c index 735042a4..a1484e7f 100644 --- a/plugins/imudp/imudp.c +++ b/plugins/imudp/imudp.c @@ -336,6 +336,9 @@ rsRetVal rcvMainLoop() nfds = epoll_wait(efd, currEvt, NUM_EPOLL_EVENTS, -1); DBGPRINTF("imudp: epoll_wait() returned with %d fds\n", nfds); + if(glbl.GetGlobalInputTermState() == 1) + break; /* terminate input! */ + for(i = 0 ; i < nfds ; ++i) { processSocket(currEvt[i].data.fd, &frominetPrev, &bIsPermitted, fromHost, fromHostFQDN, fromHostIP); @@ -343,6 +346,9 @@ rsRetVal rcvMainLoop() } finalize_it: + if(udpEPollEvt != NULL) + free(udpEPollEvt); + RETiRet; } #else /* #if HAVE_EPOLL_CREATE1 */ -- cgit