ctdb-client: Add sync version of sending multiple messages
authorAmitay Isaacs <amitay@gmail.com>
Fri, 1 Apr 2016 05:51:47 +0000 (16:51 +1100)
committerMartin Schwenke <martins@samba.org>
Tue, 5 Jul 2016 08:53:14 +0000 (10:53 +0200)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/client/client.h
ctdb/client/client_message.c

index 2aca4b5..c34d86e 100644 (file)
@@ -92,6 +92,13 @@ int ctdb_client_message(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                        struct ctdb_client_context *client,
                        uint32_t destnode, struct ctdb_req_message *message);
 
+int ctdb_client_message_multi(TALLOC_CTX *mem_ctx,
+                             struct tevent_context *ev,
+                             struct ctdb_client_context *client,
+                             uint32_t *pnn_list, int count,
+                             struct ctdb_req_message *message,
+                             int **perr_list);
+
 struct tevent_req *ctdb_client_set_message_handler_send(
                                        TALLOC_CTX *mem_ctx,
                                        struct tevent_context *ev,
index 03fcfc6..d35ee4c 100644 (file)
@@ -331,6 +331,34 @@ int ctdb_client_message(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
        return 0;
 }
 
+int ctdb_client_message_multi(TALLOC_CTX *mem_ctx,
+                             struct tevent_context *ev,
+                             struct ctdb_client_context *client,
+                             uint32_t *pnn_list, int count,
+                             struct ctdb_req_message *message,
+                             int **perr_list)
+{
+       struct tevent_req *req;
+       bool status;
+       int ret;
+
+       req = ctdb_client_message_multi_send(mem_ctx, ev, client,
+                                            pnn_list, count,
+                                            message);
+       if (req == NULL) {
+               return ENOMEM;
+       }
+
+       tevent_req_poll(req, ev);
+
+       status = ctdb_client_message_multi_recv(req, &ret, mem_ctx, perr_list);
+       if (! status) {
+               return ret;
+       }
+
+       return 0;
+}
+
 struct ctdb_client_set_message_handler_state {
        struct ctdb_client_context *client;
        uint64_t srvid;