]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Event handlers no longer return re-queue flag. Instead of using it, just
authorMartin Mares <mj@ucw.cz>
Thu, 27 Apr 2000 22:28:49 +0000 (22:28 +0000)
committerMartin Mares <mj@ucw.cz>
Thu, 27 Apr 2000 22:28:49 +0000 (22:28 +0000)
call ev_schedule() on the same handler which should work perfectly now.

conf/conf.c
lib/event.c
lib/event.h
nest/locks.c
nest/proto.c
nest/rt-table.c

index a4e0363577df09c92856e66644cd7141a09b277d..323655d30eba803f6b291e4b67dbb9a4bda5a5c4 100644 (file)
@@ -144,7 +144,7 @@ config_do_commit(struct config *c)
   return !nobs;
 }
 
-static int
+static void
 config_done(void *unused)
 {
   struct config *c;
@@ -168,7 +168,6 @@ config_done(void *unused)
       if (!config_do_commit(c))
        break;
     }
-  return 0;
 }
 
 int
index 9ac80ac8fce46822c59430a67c5380adb293c743..1f418d206b94e1f471fd3fe875f016df02d174dd 100644 (file)
@@ -50,20 +50,17 @@ ev_new(pool *p)
   return e;
 }
 
-inline int
+inline void
 ev_run(event *e)
 {
-  int keep = e->hook(e->data);
-  if (!keep)
-    ev_postpone(e);
-  return keep;
+  ev_postpone(e);
+  e->hook(e->data);
 }
 
 inline void
 ev_enqueue(event_list *l, event *e)
 {
-  if (e->n.next)
-    rem_node(&e->n);
+  ev_postpone(e);
   add_tail(l, &e->n);
 }
 
@@ -77,8 +74,12 @@ int
 ev_run_list(event_list *l)
 {
   node *n, *p;
+  list tmp_list;
 
-  WALK_LIST_DELSAFE(n, p, *l)
+  init_list(&tmp_list);
+  add_tail_list(&tmp_list, l);
+  init_list(l);
+  WALK_LIST_DELSAFE(n, p, tmp_list)
     {
       event *e = SKIP_BACK(event, n, n);
       ev_run(e);
index 32a9a3fad3891bd9922d0be17d1b2dda41e1a4b3..d85004137dbfdf60fa1bbac62b79886a95ddc582 100644 (file)
@@ -13,7 +13,7 @@
 
 typedef struct event {
   resource r;
-  int (*hook)(void *);
+  void (*hook)(void *);
   void *data;
   node n;                              /* Internal link */
 } event;
@@ -23,7 +23,7 @@ typedef list event_list;
 extern event_list global_event_list;
 
 event *ev_new(pool *);
-int ev_run(event *);
+void ev_run(event *);
 #define ev_init_list(el) init_list(el)
 void ev_enqueue(event_list *, event *);
 void ev_schedule(event *);
index 0f43c56042fa504a69e2ccdbd62a04761a6820d5..d321fab9db7d2baefbf82b359286008bf36dd98d 100644 (file)
@@ -111,7 +111,7 @@ olock_acquire(struct object_lock *l)
   ev_schedule(olock_event);
 }
 
-int
+static void
 olock_run_event(void *unused)
 {
   node *n;
@@ -132,7 +132,6 @@ olock_run_event(void *unused)
       add_tail(&olock_list, &q->n);
       q->hook(q);
     }
-  return 0;
 }
 
 void
index f6eb32c6b0c4d0fb84abc1e585ec234d73b47e40..1af76eae8151e164dc68b472bd13cdda77e97852 100644 (file)
@@ -43,7 +43,7 @@ static event *proto_flush_event;
 static char *p_states[] = { "DOWN", "START", "UP", "STOP" };
 static char *c_states[] = { "HUNGRY", "FEEDING", "HAPPY", "FLUSHING" };
 
-static int proto_flush_all(void *);
+static void proto_flush_all(void *);
 static void proto_rethink_goal(struct proto *p);
 static char *proto_state_name(struct proto *p);
 
@@ -399,7 +399,7 @@ proto_fell_down(struct proto *p)
   proto_rethink_goal(p);
 }
 
-static int
+static void
 proto_feed(void *P)
 {
   struct proto *p = P;
@@ -411,7 +411,6 @@ proto_feed(void *P)
   p->core_state = FS_HAPPY;
   proto_relink(p);
   DBG("Protocol %s up and running\n", p->name);
-  return 0;
 }
 
 void
@@ -469,7 +468,7 @@ proto_notify_state(struct proto *p, unsigned ps)
   proto_relink(p);
 }
 
-static int
+static void
 proto_flush_all(void *unused)
 {
   struct proto *p;
@@ -485,7 +484,6 @@ proto_flush_all(void *unused)
       proto_relink(p);
       proto_fell_down(p);
     }
-  return 0;
 }
 
 /*
index 6ad5b06f385970b2965024c81d479e884505b9ee..ae27ceb739e4860275b49b0263b7b741837725fe 100644 (file)
@@ -466,7 +466,7 @@ rt_dump_all(void)
     rt_dump(t);
 }
 
-static int
+static void
 rt_gc(void *tab)
 {
   rtable *t = tab;
@@ -474,7 +474,6 @@ rt_gc(void *tab)
   DBG("Entered routing table garbage collector for %s after %d seconds and %d deletes\n",
       t->name, (int)(now - t->gc_time), t->gc_counter);
   rt_prune(t);
-  return 0;
 }
 
 void