mirror of
https://github.com/samba-team/samba.git
synced 2025-03-10 12:58:35 +03:00
s4/messaging: Return the number of previously-registered functions that are removed
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
e29c3374bc
commit
77d8b6762f
@ -316,19 +316,21 @@ NTSTATUS imessaging_register_tmp(struct imessaging_context *msg, void *private_d
|
||||
}
|
||||
|
||||
/*
|
||||
De-register the function for a particular message type.
|
||||
De-register the function for a particular message type. Return the number of
|
||||
functions deregistered.
|
||||
*/
|
||||
void imessaging_deregister(struct imessaging_context *msg, uint32_t msg_type, void *private_data)
|
||||
size_t imessaging_deregister(struct imessaging_context *msg, uint32_t msg_type, void *private_data)
|
||||
{
|
||||
struct dispatch_fn *d, *next;
|
||||
size_t removed = 0;
|
||||
|
||||
if (msg_type >= msg->num_types) {
|
||||
d = (struct dispatch_fn *)idr_find(msg->dispatch_tree,
|
||||
msg_type);
|
||||
if (!d) return;
|
||||
if (!d) return 0;
|
||||
idr_remove(msg->dispatch_tree, msg_type);
|
||||
talloc_free(d);
|
||||
return;
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (d = msg->dispatch[msg_type]; d; d = next) {
|
||||
@ -336,8 +338,11 @@ void imessaging_deregister(struct imessaging_context *msg, uint32_t msg_type, vo
|
||||
if (d->private_data == private_data) {
|
||||
DLIST_REMOVE(msg->dispatch[msg_type], d);
|
||||
talloc_free(d);
|
||||
++removed;
|
||||
}
|
||||
}
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -62,7 +62,7 @@ struct imessaging_context *imessaging_client_init(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev);
|
||||
NTSTATUS imessaging_send_ptr(struct imessaging_context *msg, struct server_id server,
|
||||
uint32_t msg_type, void *ptr);
|
||||
void imessaging_deregister(struct imessaging_context *msg, uint32_t msg_type, void *private_data);
|
||||
size_t imessaging_deregister(struct imessaging_context *msg, uint32_t msg_type, void *private_data);
|
||||
struct server_id imessaging_get_server_id(struct imessaging_context *msg_ctx);
|
||||
NTSTATUS imessaging_process_cleanup(struct imessaging_context *msg_ctx,
|
||||
pid_t pid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user