messaging3: Add and use messaging_tevent_context()
authorVolker Lendecke <vl@samba.org>
Thu, 29 May 2014 14:44:32 +0000 (16:44 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 30 May 2014 23:59:17 +0000 (01:59 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/messages.h
source3/lib/ctdbd_conn.c
source3/lib/messages.c
source3/lib/messages_dgm.c

index bea3fd00370af54fe27f91b4d8c6b2f6e0c46dc5..d029d66c2724c85e2cf9acbbf78086a5fb318827 100644 (file)
@@ -116,6 +116,8 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
                                         struct tevent_context *ev);
 
 struct server_id messaging_server_id(const struct messaging_context *msg_ctx);
+struct tevent_context *messaging_tevent_context(
+       struct messaging_context *msg_ctx);
 struct messaging_backend *messaging_local_backend(
        struct messaging_context *msg_ctx);
 
index 35845eda76df19645252717b2ad3cedf7cb516fe..201c70029050ff52cd18d4402f155be2037660e2 100644 (file)
@@ -496,8 +496,8 @@ static NTSTATUS ctdb_read_req(struct ctdbd_connection *conn, uint32_t reqid,
                 * We're waiting for a call reply, but an async message has
                 * crossed. Defer dispatching to the toplevel event loop.
                 */
-               evt = tevent_add_timer(conn->msg_ctx->event_ctx,
-                                     conn->msg_ctx->event_ctx,
+               evt = tevent_add_timer(messaging_tevent_context(conn->msg_ctx),
+                                     messaging_tevent_context(conn->msg_ctx),
                                      timeval_zero(),
                                      deferred_message_dispatch,
                                      msg_state);
@@ -747,7 +747,8 @@ NTSTATUS ctdbd_register_msg_ctx(struct ctdbd_connection *conn,
        SMB_ASSERT(conn->msg_ctx == NULL);
        SMB_ASSERT(conn->fde == NULL);
 
-       if (!(conn->fde = tevent_add_fd(msg_ctx->event_ctx, conn,
+       if (!(conn->fde = tevent_add_fd(messaging_tevent_context(msg_ctx),
+                                      conn,
                                       ctdb_packet_get_fd(conn->pkt),
                                       TEVENT_FD_READ,
                                       ctdbd_socket_handler,
index db7257dba54fd7ff8803046343ddaaa023725215..3d838fe908c420a690a4dff0a5443e47500062b5 100644 (file)
@@ -868,4 +868,10 @@ struct messaging_backend *messaging_local_backend(
        return msg_ctx->local;
 }
 
+struct tevent_context *messaging_tevent_context(
+       struct messaging_context *msg_ctx)
+{
+       return msg_ctx->event_ctx;
+}
+
 /** @} **/
index cf6e19075a8c46da82e429f45f9db34b9a6f51d6..9b58d9e0336d89efadf837771d6ab5f459ed82eb 100644 (file)
@@ -232,7 +232,8 @@ NTSTATUS messaging_dgm_init(struct messaging_context *msg_ctx,
        }
 
        ctx->tevent_handle = poll_funcs_tevent_register(
-               ctx, ctx->msg_callbacks, msg_ctx->event_ctx);
+               ctx, ctx->msg_callbacks,
+               messaging_tevent_context(msg_ctx));
        if (ctx->tevent_handle == NULL) {
                TALLOC_FREE(result);
                return NT_STATUS_NO_MEMORY;