]> granicus.if.org Git - libevent/commitdiff
avoid double recacle when loop_once is used; from Richard Nyberg
authorNiels Provos <provos@gmail.com>
Sat, 3 Dec 2005 20:51:23 +0000 (20:51 +0000)
committerNiels Provos <provos@gmail.com>
Sat, 3 Dec 2005 20:51:23 +0000 (20:51 +0000)
svn:r187

event.c

diff --git a/event.c b/event.c
index 2a2150ac587e0e482b55f4d165f49267ee57c6a0..0d6de870f31db6c5633d07b7b349275f48c4dd07 100644 (file)
--- a/event.c
+++ b/event.c
@@ -313,12 +313,12 @@ event_base_loop(struct event_base *base, int flags)
        struct timeval tv;
        int res, done;
 
-       /* Calculate the initial events that we are waiting for */
-       if (evsel->recalc(base, evbase, 0) == -1)
-               return (-1);
-
        done = 0;
        while (!done) {
+               /* Calculate the initial events that we are waiting for */
+               if (evsel->recalc(base, evbase, 0) == -1)
+                       return (-1);
+
                /* Terminate the loop if we have been asked to */
                if (base->event_gotterm) {
                        base->event_gotterm = 0;
@@ -372,9 +372,6 @@ event_base_loop(struct event_base *base, int flags)
                                done = 1;
                } else if (flags & EVLOOP_NONBLOCK)
                        done = 1;
-
-               if (evsel->recalc(base, evbase, 0) == -1)
-                       return (-1);
        }
 
        event_debug(("%s: asked to terminate loop.", __func__));