mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
messaging: Factor out messaging_dispatch_waiters
No real code change: This makes dispatching to non-classic receives available for other callers. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
667307cd78
commit
17a472bc99
@ -87,6 +87,9 @@ struct messaging_context {
|
||||
|
||||
static struct messaging_rec *messaging_rec_dup(TALLOC_CTX *mem_ctx,
|
||||
struct messaging_rec *rec);
|
||||
static bool messaging_dispatch_waiters(struct messaging_context *msg_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct messaging_rec *rec);
|
||||
static void messaging_dispatch_rec(struct messaging_context *msg_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct messaging_rec *rec);
|
||||
@ -966,32 +969,14 @@ static bool messaging_dispatch_classic(struct messaging_context *msg_ctx,
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
Dispatch one messaging_rec
|
||||
*/
|
||||
static void messaging_dispatch_rec(struct messaging_context *msg_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct messaging_rec *rec)
|
||||
static bool messaging_dispatch_waiters(struct messaging_context *msg_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct messaging_rec *rec)
|
||||
{
|
||||
size_t i;
|
||||
bool consumed;
|
||||
|
||||
if (ev == msg_ctx->event_ctx) {
|
||||
consumed = messaging_dispatch_classic(msg_ctx, rec);
|
||||
if (consumed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!messaging_append_new_waiters(msg_ctx)) {
|
||||
size_t j;
|
||||
for (j=0; j < rec->num_fds; j++) {
|
||||
int fd = rec->fds[j];
|
||||
close(fd);
|
||||
}
|
||||
rec->num_fds = 0;
|
||||
rec->fds = NULL;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
@ -1022,12 +1007,37 @@ static void messaging_dispatch_rec(struct messaging_context *msg_ctx,
|
||||
if ((ev == state->ev) &&
|
||||
state->filter(rec, state->private_data)) {
|
||||
messaging_filtered_read_done(req, rec);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
i += 1;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
Dispatch one messaging_rec
|
||||
*/
|
||||
static void messaging_dispatch_rec(struct messaging_context *msg_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct messaging_rec *rec)
|
||||
{
|
||||
bool consumed;
|
||||
size_t i;
|
||||
|
||||
if (ev == msg_ctx->event_ctx) {
|
||||
consumed = messaging_dispatch_classic(msg_ctx, rec);
|
||||
if (consumed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
consumed = messaging_dispatch_waiters(msg_ctx, ev, rec);
|
||||
if (consumed) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev != msg_ctx->event_ctx) {
|
||||
struct iovec iov;
|
||||
int fds[rec->num_fds];
|
||||
|
Loading…
x
Reference in New Issue
Block a user