return true;
}
-static void messaging_dispatch_classic(struct messaging_context *msg_ctx,
+static bool messaging_dispatch_classic(struct messaging_context *msg_ctx,
struct messaging_rec *rec)
{
struct messaging_callback *cb, *next;
cb->fn(msg_ctx, cb->private_data, rec->msg_type,
rec->src, &rec->buf);
- /*
- * we continue looking for matching messages after finding
- * one. This matters for subsystems like the internal notify
- * code which register more than one handler for the same
- * message type
- */
+ return true;
}
+
+ return false;
}
/*
struct messaging_rec *rec)
{
size_t i;
+ bool consumed;
if (ev == msg_ctx->event_ctx) {
- messaging_dispatch_classic(msg_ctx, rec);
+ consumed = messaging_dispatch_classic(msg_ctx, rec);
+ if (consumed) {
+ return;
+ }
}
if (!messaging_append_new_waiters(msg_ctx)) {
if ((ev == state->ev) &&
state->filter(rec, state->private_data)) {
messaging_filtered_read_done(req, rec);
-
- /*
- * Only the first one gets the fd-array
- */
- rec->num_fds = 0;
- rec->fds = NULL;
+ return;
}
i += 1;
goto fail;
}
- for (i=0; i<3; i++) {
+ for (i=0; i<2; i++) {
if (tevent_loop_once(ev) != 0) {
fprintf(stderr, "tevent_loop_once failed\n");
goto fail;
printf("%u/%u\n", count1, count2);
- if ((count1 != 1) || (count2 != 1)){
- fprintf(stderr, "Got %u/%u msgs, expected 1 each\n",
+ if ((count1 != 1) || (count2 != 0)) {
+ fprintf(stderr, "Got %u/%u msgs, expected 1/0\n",
count1, count2);
goto fail;
}