summaryrefslogtreecommitdiffstats
path: root/source3/lib/messages.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-07-17 11:23:46 +0000
committerJeremy Allison <jra@samba.org>2014-08-11 23:57:12 +0200
commit3aa3c6ed012dd344cbc91ac49870c6adc4c3d891 (patch)
treede78f678b7cd8cf178455582b4c9fbc115b5b10d /source3/lib/messages.c
parent28db680a0df9ce4329668d50ce7ba6d5a7c29761 (diff)
downloadsamba-3aa3c6ed012dd344cbc91ac49870c6adc4c3d891.tar.gz
samba-3aa3c6ed012dd344cbc91ac49870c6adc4c3d891.tar.xz
samba-3aa3c6ed012dd344cbc91ac49870c6adc4c3d891.zip
messaging3: Directly refer to messaging_dgm in messages.c
This removes the messaging_backend abstraction layer from messages_dgm.c. That layer was introduced for ctdb and is still used there. But as the messaging_dgm interface is very slim anyway, I don't think directly calling it is too bad. Why this commit? It is another step towards making messages_dgm independent of messages.[ch], thus it might become usable in other contexts like ctdb and source4 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/lib/messages.c')
-rw-r--r--source3/lib/messages.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 78a867adf4..18376bbe53 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -72,7 +72,8 @@ struct messaging_context {
struct tevent_req **waiters;
unsigned num_waiters;
- struct messaging_backend *local;
+ struct messaging_dgm_context *local;
+
struct messaging_backend *remote;
bool *have_context;
@@ -245,7 +246,7 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
ctx->have_context = &have_context;
ret = messaging_dgm_init(ctx, ctx->event_ctx, ctx->id,
- &ctx->local, messaging_recv_cb, ctx);
+ messaging_recv_cb, ctx, &ctx->local);
if (ret != 0) {
DEBUG(2, ("messaging_dgm_init failed: %s\n", strerror(ret)));
@@ -304,8 +305,8 @@ NTSTATUS messaging_reinit(struct messaging_context *msg_ctx)
msg_ctx->id = procid_self();
ret = messaging_dgm_init(msg_ctx, msg_ctx->event_ctx,
- msg_ctx->id, &msg_ctx->local,
- messaging_recv_cb, msg_ctx);
+ msg_ctx->id, messaging_recv_cb, msg_ctx,
+ &msg_ctx->local);
if (ret != 0) {
DEBUG(0, ("messaging_dgm_init failed: %s\n", strerror(errno)));
return map_nt_error_from_unix(ret);
@@ -468,8 +469,8 @@ NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
return NT_STATUS_OK;
}
- ret = msg_ctx->local->send_fn(msg_ctx->id, server, msg_type,
- iov, iovlen, msg_ctx->local);
+ ret = messaging_dgm_send(msg_ctx->local, msg_ctx->id, server, msg_type,
+ iov, iovlen);
if (ret != 0) {
return map_nt_error_from_unix(ret);
}
@@ -536,7 +537,7 @@ struct tevent_req *messaging_filtered_read_send(
tevent_req_defer_callback(req, state->ev);
state->tevent_handle = messaging_dgm_register_tevent_context(
- state, msg_ctx, ev);
+ state, msg_ctx->local, ev);
if (tevent_req_nomem(state, req)) {
return tevent_req_post(req, ev);
}
@@ -899,7 +900,7 @@ static int mess_parent_dgm_cleanup(void *private_data)
private_data, struct messaging_context);
int ret;
- ret = messaging_dgm_wipe(msg_ctx);
+ ret = messaging_dgm_wipe(msg_ctx->local);
DEBUG(10, ("messaging_dgm_wipe returned %s\n",
ret ? strerror(ret) : "ok"));
return lp_parm_int(-1, "messaging", "messaging dgm cleanup interval",
@@ -933,20 +934,14 @@ int messaging_cleanup(struct messaging_context *msg_ctx, pid_t pid)
int ret;
if (pid == 0) {
- ret = messaging_dgm_wipe(msg_ctx);
+ ret = messaging_dgm_wipe(msg_ctx->local);
} else {
- ret = messaging_dgm_cleanup(msg_ctx, pid);
+ ret = messaging_dgm_cleanup(msg_ctx->local, pid);
}
return ret;
}
-struct messaging_backend *messaging_local_backend(
- struct messaging_context *msg_ctx)
-{
- return msg_ctx->local;
-}
-
struct tevent_context *messaging_tevent_context(
struct messaging_context *msg_ctx)
{