]> git.meshlink.io Git - catta/blobdiff - avahi-core/timeeventq.c
Sending translation for Hungarian
[catta] / avahi-core / timeeventq.c
index 5e24ba33b4481f8e31cc647d244d88eff56594c8..17334ee063ba55af276bb6e19aeb12fbb4305b5f 100644 (file)
@@ -59,25 +59,31 @@ static int compare(const void* _a, const void* _b) {
     return avahi_timeval_compare(&a->last_run, &b->last_run);
 }
 
+static AvahiTimeEvent* time_event_queue_root(AvahiTimeEventQueue *q) {
+    assert(q);
+
+    return q->prioq->root ? q->prioq->root->data : NULL;
+}
+
 static void update_timeout(AvahiTimeEventQueue *q) {
     AvahiTimeEvent *e;
     assert(q);
 
-    if ((e = avahi_time_event_queue_root(q)))
+    if ((e = time_event_queue_root(q)))
         q->poll_api->timeout_update(q->timeout, &e->expiry);
     else
         q->poll_api->timeout_update(q->timeout, NULL);
 }
 
-static void expiration_event(AvahiTimeout *timeout, void *userdata) {
-    struct timeval now;
+static void expiration_event(AVAHI_GCC_UNUSED AvahiTimeout *timeout, void *userdata) {
     AvahiTimeEventQueue *q = userdata;
     AvahiTimeEvent *e;
 
-    gettimeofday(&now, NULL);
-    
-    if ((e = avahi_time_event_queue_root(q))) {
+    if ((e = time_event_queue_root(q))) {
+        struct timeval now;
 
+        gettimeofday(&now, NULL);
+    
         /* Check if expired */
         if (avahi_timeval_compare(&now, &e->expiry) >= 0) {
 
@@ -88,9 +94,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 +108,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)
@@ -139,7 +151,7 @@ void avahi_time_event_queue_free(AvahiTimeEventQueue *q) {
     
     assert(q);
 
-    while ((e = avahi_time_event_queue_root(q)))
+    while ((e = time_event_queue_root(q)))
         avahi_time_event_free(e);
     avahi_prio_queue_free(q->prioq);
 
@@ -213,16 +225,3 @@ void avahi_time_event_update(AvahiTimeEvent *e, const struct timeval *timeval) {
     update_timeout(e->queue);
 }
 
-AvahiTimeEvent* avahi_time_event_queue_root(AvahiTimeEventQueue *q) {
-    assert(q);
-
-    return q->prioq->root ? q->prioq->root->data : NULL;
-}
-
-AvahiTimeEvent* avahi_time_event_next(AvahiTimeEvent *e) {
-    assert(e);
-
-    return e->node->next->data;
-}
-
-