X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=blobdiff_plain;f=src%2FIOEngine_epoll.c;h=d1c139f6970f734a4fdb65ef2b9d5dde12e50e30;hp=e36394960f3af206bf4fa594fc10732e2de324f1;hb=f83bd22fe2dcb3ca0ddb9321944ee0b9c9b61ea6;hpb=ff58997de5ecd501485f9214f4fbdc4766157b42 diff --git a/src/IOEngine_epoll.c b/src/IOEngine_epoll.c index e363949..d1c139f 100644 --- a/src/IOEngine_epoll.c +++ b/src/IOEngine_epoll.c @@ -83,8 +83,14 @@ static void engine_epoll_loop(struct timeval *timeout) { tdiff.tv_sec = timer_priority->timeout.tv_sec - now.tv_sec; tdiff.tv_usec = timer_priority->timeout.tv_usec - now.tv_usec; if(tdiff.tv_sec < 0 || (tdiff.tv_sec == 0 && tdiff.tv_usec <= 0)) { - iohandler_events(timer_priority, 0, 0); - iohandler_close(timer_priority); //also sets timer_priority to the next timed element + if(timer_priority->constant_timeout) { + tdiff.tv_sec = 0; + iohandler_set_timeout(timer_priority, &tdiff); + iohandler_events(timer_priority, 0, 0); + } else { + iohandler_events(timer_priority, 0, 0); + iohandler_close(timer_priority); //also sets timer_priority to the next timed element + } continue; } else if(tdiff.tv_usec < 0) { tdiff.tv_sec--; @@ -120,8 +126,14 @@ static void engine_epoll_loop(struct timeval *timeout) { tdiff.tv_sec = timer_priority->timeout.tv_sec - now.tv_sec; tdiff.tv_usec = timer_priority->timeout.tv_usec - now.tv_usec; if(tdiff.tv_sec < 0 || (tdiff.tv_sec == 0 && tdiff.tv_usec <= 0)) { - iohandler_events(timer_priority, 0, 0); - iohandler_close(timer_priority); //also sets timer_priority to the next timed element + if(timer_priority->constant_timeout) { + tdiff.tv_sec = 0; + iohandler_set_timeout(timer_priority, &tdiff); + iohandler_events(timer_priority, 0, 0); + } else { + iohandler_events(timer_priority, 0, 0); + iohandler_close(timer_priority); //also sets timer_priority to the next timed element + } continue; } break;