summaryrefslogtreecommitdiffstats
path: root/avahi-common/simple-watch.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-08-15 16:07:29 +0000
committerLennart Poettering <lennart@poettering.net>2005-08-15 16:07:29 +0000
commit7ada090e70d25937d27b2e93b0dab4d9d68c5d23 (patch)
tree6d1da099d6b621b442e7a775783c752be182b186 /avahi-common/simple-watch.c
parentfe367caf27dd022258218a768da1ae2ddd246203 (diff)
* fix a bad memory access bug in avahi_strndup()
* some small optimizations to call gettimeofday() less often * fix dbus-watch-glue to call dbus_connection_dispatch() git-svn-id: file:///home/lennart/svn/public/avahi/trunk@333 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-common/simple-watch.c')
-rw-r--r--avahi-common/simple-watch.c11
1 files changed, 11 insertions, 0 deletions
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);