X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=blobdiff_plain;f=src%2FIOEngine_kevent.c;fp=src%2FIOEngine_kevent.c;h=ee93f8645f09f63a25cb750df661d70b91c3d535;hp=f729dbbe820694181ee43d4ebf6dda7b7c9bfb47;hb=1361faa990413b8f09967597ebe0a70dabeab0b3;hpb=5cd595edf6322d8968be3709dab8ae84012fa79e diff --git a/src/IOEngine_kevent.c b/src/IOEngine_kevent.c index f729dbb..ee93f86 100644 --- a/src/IOEngine_kevent.c +++ b/src/IOEngine_kevent.c @@ -89,8 +89,14 @@ static void engine_kevent_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--; @@ -130,8 +136,14 @@ static void engine_kevent_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;