]> git.meshlink.io Git - catta/blobdiff - avahi-common/simple-watch.c
add another status line to configure.ac
[catta] / avahi-common / simple-watch.c
index c3ed86ff362c15ca25b17661a43deac3dfe035ad..4bb763a953b718b7a50aed0906ff9a070a9f0546 100644 (file)
@@ -158,6 +158,7 @@ static void remove_pollfd(AvahiWatch *w) {
 
 static void watch_free(AvahiWatch *w) {
     assert(w);
+
     assert(!w->dead);
 
     remove_pollfd(w);
@@ -392,6 +393,17 @@ int avahi_simple_poll_iterate(AvahiSimplePoll *s, int timeout) {
         int t;
         AvahiUsec usec;
 
+        if (next_timeout->expiry.tv_sec == 0 &&
+            next_timeout->expiry.tv_usec == 0) {
+
+            /* Just a shortcut so that we don't need to call gettimeofday() */
+            
+            /* The events poll() returned in the last call are now no longer valid */
+            s->events_valid = 0;
+            return start_timeout_callback(next_timeout);
+        }
+
+            
         gettimeofday(&now, NULL);
         usec = avahi_timeval_diff(&next_timeout->expiry, &now);