diff options
author | Volker Lendecke <vl@samba.org> | 2013-12-30 11:26:52 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2014-01-21 08:10:41 +0100 |
commit | 5f3ccfc16b7c64d2de109ba26d92d22ae1010882 (patch) | |
tree | ff43659880bca36e4a0a33aef2a85bcc66a4abdd /source3/include/messages.h | |
parent | eee450fec2f7cb5f45c47162fd5b7c0717978598 (diff) | |
download | samba-5f3ccfc16b7c64d2de109ba26d92d22ae1010882.tar.gz |
messaging3: Add messaging_read_send/recv
This is made to replace the msg_channel abstraction.
msg_channel was created to not miss any messages. For this, some
complex queueing was installed. This complexity has caused quite a
few problems in the past (see bug 10284 for example).
messaging_read_send/recv is able to achieve the same goal with a
lot less complexity. The messaging_read_send atomically installs
the reader into the messaging_context, we will not miss any messages
while this installed. messaging_send_recv will deinstall that
listener, but in the callback function you can directly call
messaging_read_send again without going through the tevent_loop_once.
As long as this is always made sure, no messages will be lost.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/include/messages.h')
-rw-r--r-- | source3/include/messages.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/include/messages.h b/source3/include/messages.h index cefa2793fd5..27b315642c6 100644 --- a/source3/include/messages.h +++ b/source3/include/messages.h @@ -80,6 +80,9 @@ struct messaging_context { struct tevent_context *event_ctx; struct messaging_callback *callbacks; + struct tevent_req **waiters; + unsigned num_waiters; + struct messaging_backend *local; struct messaging_backend *remote; }; @@ -140,6 +143,13 @@ NTSTATUS messaging_send_buf(struct messaging_context *msg_ctx, void messaging_dispatch_rec(struct messaging_context *msg_ctx, struct messaging_rec *rec); +struct tevent_req *messaging_read_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct messaging_context *msg, + uint32_t msg_type); +int messaging_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, + struct messaging_rec **presult); + #include "librpc/gen_ndr/ndr_messaging.h" #endif |