Event handlers no longer return re-queue flag. Instead of using it, just
call ev_schedule() on the same handler which should work perfectly now.
This commit is contained in:
parent
987de54578
commit
8f6accb5bb
6 changed files with 17 additions and 21 deletions
|
@ -144,7 +144,7 @@ config_do_commit(struct config *c)
|
||||||
return !nobs;
|
return !nobs;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
config_done(void *unused)
|
config_done(void *unused)
|
||||||
{
|
{
|
||||||
struct config *c;
|
struct config *c;
|
||||||
|
@ -168,7 +168,6 @@ config_done(void *unused)
|
||||||
if (!config_do_commit(c))
|
if (!config_do_commit(c))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
15
lib/event.c
15
lib/event.c
|
@ -50,20 +50,17 @@ ev_new(pool *p)
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int
|
inline void
|
||||||
ev_run(event *e)
|
ev_run(event *e)
|
||||||
{
|
{
|
||||||
int keep = e->hook(e->data);
|
|
||||||
if (!keep)
|
|
||||||
ev_postpone(e);
|
ev_postpone(e);
|
||||||
return keep;
|
e->hook(e->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
ev_enqueue(event_list *l, event *e)
|
ev_enqueue(event_list *l, event *e)
|
||||||
{
|
{
|
||||||
if (e->n.next)
|
ev_postpone(e);
|
||||||
rem_node(&e->n);
|
|
||||||
add_tail(l, &e->n);
|
add_tail(l, &e->n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,8 +74,12 @@ int
|
||||||
ev_run_list(event_list *l)
|
ev_run_list(event_list *l)
|
||||||
{
|
{
|
||||||
node *n, *p;
|
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);
|
event *e = SKIP_BACK(event, n, n);
|
||||||
ev_run(e);
|
ev_run(e);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
typedef struct event {
|
typedef struct event {
|
||||||
resource r;
|
resource r;
|
||||||
int (*hook)(void *);
|
void (*hook)(void *);
|
||||||
void *data;
|
void *data;
|
||||||
node n; /* Internal link */
|
node n; /* Internal link */
|
||||||
} event;
|
} event;
|
||||||
|
@ -23,7 +23,7 @@ typedef list event_list;
|
||||||
extern event_list global_event_list;
|
extern event_list global_event_list;
|
||||||
|
|
||||||
event *ev_new(pool *);
|
event *ev_new(pool *);
|
||||||
int ev_run(event *);
|
void ev_run(event *);
|
||||||
#define ev_init_list(el) init_list(el)
|
#define ev_init_list(el) init_list(el)
|
||||||
void ev_enqueue(event_list *, event *);
|
void ev_enqueue(event_list *, event *);
|
||||||
void ev_schedule(event *);
|
void ev_schedule(event *);
|
||||||
|
|
|
@ -111,7 +111,7 @@ olock_acquire(struct object_lock *l)
|
||||||
ev_schedule(olock_event);
|
ev_schedule(olock_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static void
|
||||||
olock_run_event(void *unused)
|
olock_run_event(void *unused)
|
||||||
{
|
{
|
||||||
node *n;
|
node *n;
|
||||||
|
@ -132,7 +132,6 @@ olock_run_event(void *unused)
|
||||||
add_tail(&olock_list, &q->n);
|
add_tail(&olock_list, &q->n);
|
||||||
q->hook(q);
|
q->hook(q);
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -43,7 +43,7 @@ static event *proto_flush_event;
|
||||||
static char *p_states[] = { "DOWN", "START", "UP", "STOP" };
|
static char *p_states[] = { "DOWN", "START", "UP", "STOP" };
|
||||||
static char *c_states[] = { "HUNGRY", "FEEDING", "HAPPY", "FLUSHING" };
|
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 void proto_rethink_goal(struct proto *p);
|
||||||
static char *proto_state_name(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);
|
proto_rethink_goal(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
proto_feed(void *P)
|
proto_feed(void *P)
|
||||||
{
|
{
|
||||||
struct proto *p = P;
|
struct proto *p = P;
|
||||||
|
@ -411,7 +411,6 @@ proto_feed(void *P)
|
||||||
p->core_state = FS_HAPPY;
|
p->core_state = FS_HAPPY;
|
||||||
proto_relink(p);
|
proto_relink(p);
|
||||||
DBG("Protocol %s up and running\n", p->name);
|
DBG("Protocol %s up and running\n", p->name);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -469,7 +468,7 @@ proto_notify_state(struct proto *p, unsigned ps)
|
||||||
proto_relink(p);
|
proto_relink(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
proto_flush_all(void *unused)
|
proto_flush_all(void *unused)
|
||||||
{
|
{
|
||||||
struct proto *p;
|
struct proto *p;
|
||||||
|
@ -485,7 +484,6 @@ proto_flush_all(void *unused)
|
||||||
proto_relink(p);
|
proto_relink(p);
|
||||||
proto_fell_down(p);
|
proto_fell_down(p);
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -466,7 +466,7 @@ rt_dump_all(void)
|
||||||
rt_dump(t);
|
rt_dump(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
rt_gc(void *tab)
|
rt_gc(void *tab)
|
||||||
{
|
{
|
||||||
rtable *t = 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",
|
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);
|
t->name, (int)(now - t->gc_time), t->gc_counter);
|
||||||
rt_prune(t);
|
rt_prune(t);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue