From 7ada090e70d25937d27b2e93b0dab4d9d68c5d23 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 15 Aug 2005 16:07:29 +0000 Subject: * 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 --- avahi-core/iface.c | 2 +- avahi-core/timeeventq.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'avahi-core') diff --git a/avahi-core/iface.c b/avahi-core/iface.c index 3d90657..b2c52f9 100644 --- a/avahi-core/iface.c +++ b/avahi-core/iface.c @@ -507,7 +507,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat m->list = LIST_ADDR; } else { m->list = LIST_DONE; - avahi_log_debug("Networ interface enumeration completed"); + avahi_log_debug("Network interface enumeration completed"); } } else if (n->nlmsg_type == NLMSG_ERROR && (n->nlmsg_seq == m->query_link_seq || n->nlmsg_seq == m->query_addr_seq)) { diff --git a/avahi-core/timeeventq.c b/avahi-core/timeeventq.c index 5e24ba3..a259ba6 100644 --- a/avahi-core/timeeventq.c +++ b/avahi-core/timeeventq.c @@ -70,14 +70,14 @@ static void update_timeout(AvahiTimeEventQueue *q) { } static void expiration_event(AvahiTimeout *timeout, void *userdata) { - struct timeval now; AvahiTimeEventQueue *q = userdata; AvahiTimeEvent *e; - gettimeofday(&now, NULL); - if ((e = avahi_time_event_queue_root(q))) { + struct timeval now; + gettimeofday(&now, NULL); + /* Check if expired */ if (avahi_timeval_compare(&now, &e->expiry) >= 0) { @@ -88,9 +88,13 @@ static void expiration_event(AvahiTimeout *timeout, void *userdata) { /* Run it */ assert(e->callback); e->callback(e, e->userdata); - } + + update_timeout(q); + return; + } } + avahi_log_debug(__FILE__": Strange, expiration_event() called, but nothing really happened."); update_timeout(q); } @@ -98,6 +102,8 @@ static void fix_expiry_time(AvahiTimeEvent *e) { struct timeval now; assert(e); + return; /*** DO WE REALLY NEED THIS? ***/ + gettimeofday(&now, NULL); if (avahi_timeval_compare(&now, &e->expiry) > 0) -- cgit