ctdbd_conn: Expose ctdb socket readability handler
authorVolker Lendecke <vl@samba.org>
Sun, 24 Apr 2016 15:36:00 +0000 (17:36 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 17 May 2016 11:18:31 +0000 (13:18 +0200)
This will obsolete ctdbd_register_msg_ctx soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/include/ctdbd_conn.h
source3/lib/ctdbd_conn.c

index 026db04babd074136a8af079cc2db14343611fc4..282379dc9d68210cb3e9bd54c2fb7721bd2e529f 100644 (file)
@@ -42,6 +42,7 @@ int ctdbd_register_msg_ctx(struct ctdbd_connection *conn,
 struct messaging_context *ctdb_conn_msg_ctx(struct ctdbd_connection *conn);
 
 int ctdbd_conn_get_fd(struct ctdbd_connection *conn);
+void ctdbd_socket_readable(struct ctdbd_connection *conn);
 
 int ctdbd_messaging_send_iov(struct ctdbd_connection *conn,
                             uint32_t dst_vnn, uint64_t dst_srvid,
index 18849757470fafe800b571ff5e7e709aba5cf576..e54ec7e8d0017aeda8402bf35a38ad16e0a48c22 100644 (file)
@@ -508,17 +508,8 @@ static int ctdb_handle_message(struct ctdbd_connection *conn,
        return 0;
 }
 
-/*
- * The ctdbd socket is readable asynchronuously
- */
-
-static void ctdbd_socket_handler(struct tevent_context *event_ctx,
-                                struct tevent_fd *event,
-                                uint16_t flags,
-                                void *private_data)
+void ctdbd_socket_readable(struct ctdbd_connection *conn)
 {
-       struct ctdbd_connection *conn = talloc_get_type_abort(
-               private_data, struct ctdbd_connection);
        struct ctdb_req_header *hdr = NULL;
        int ret;
 
@@ -538,6 +529,25 @@ static void ctdbd_socket_handler(struct tevent_context *event_ctx,
        }
 }
 
+/*
+ * The ctdbd socket is readable asynchronuously
+ */
+
+static void ctdbd_socket_handler(struct tevent_context *event_ctx,
+                                struct tevent_fd *event,
+                                uint16_t flags,
+                                void *private_data)
+{
+       struct ctdbd_connection *conn = talloc_get_type_abort(
+               private_data, struct ctdbd_connection);
+
+       if ((flags & TEVENT_FD_READ) == 0) {
+               return;
+       }
+
+       ctdbd_socket_readable(conn);
+}
+
 /*
  * Prepare a ctdbd connection to receive messages
  */