X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;ds=sidebyside;f=avahi-common%2Fsimple-watch.c;h=4bb763a953b718b7a50aed0906ff9a070a9f0546;hb=e8e2707e96c08eda0ec6df2510dae4e6c71111ed;hp=770cf4fe67a8bb4c2458265bf4a8ddd45e62289e;hpb=deb6bcac8d1e1ecec4aafaee2d27dbe467e4f461;p=catta diff --git a/avahi-common/simple-watch.c b/avahi-common/simple-watch.c index 770cf4f..4bb763a 100644 --- a/avahi-common/simple-watch.c +++ b/avahi-common/simple-watch.c @@ -393,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);