move some timed event calls out from libctdb and put it back in client/ctdb_client.c
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 12 May 2010 04:16:17 +0000 (14:16 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 12 May 2010 04:16:17 +0000 (14:16 +1000)
client/ctdb_client.c
include/ctdb_private.h
libctdb/ctdb_client.c

index a0d5997d50ea23ecffb140c188143e36d10ae3f9..f97d739a3b54ecaf340c96926fa5adaec07c28c0 100644 (file)
@@ -3480,3 +3480,24 @@ int ctdb_ctrl_get_db_priority(struct ctdb_context *ctdb, struct timeval timeout,
 
        return 0;
 }
+
+/* time out handler for ctdb_control */
+void ctdb_control_timeout_func(struct event_context *ev, struct timed_event *te, 
+       struct timeval t, void *private_data)
+{
+       struct ctdb_client_control_state *state = talloc_get_type(private_data, struct ctdb_client_control_state);
+
+       DEBUG(DEBUG_ERR,(__location__ " control timed out. reqid:%u opcode:%u "
+                        "dstnode:%u\n", state->reqid, state->c->opcode,
+                        state->c->hdr.destnode));
+
+       state->state = CTDB_CONTROL_TIMEOUT;
+
+       /* if we had a callback registered for this control, pull the response
+          and call the callback.
+       */
+       if (state->async.fn) {
+               event_add_timed(state->ctdb->ev, state, timeval_zero(), ctdb_invoke_control_callback, state);
+       }
+}
+
index 685048b0faf37a93faf93b99bba58346d1deb88d..658ba9b7319b56be3ecbc10ef630d79a3a814e68 100644 (file)
@@ -1647,4 +1647,10 @@ int verify_remote_ip_allocation(struct ctdb_context *ctdb,
 int update_ip_assignment_tree(struct ctdb_context *ctdb,
                                struct ctdb_public_ip *ip);
 
+void ctdb_control_timeout_func(struct event_context *ev,
+                              struct timed_event *te, 
+                              struct timeval t, void *private_data);
+
+void ctdb_invoke_control_callback(struct event_context *ev, struct timed_event *te, struct timeval t, void *private_data);
+
 #endif
index c7ce13889d74f969b1011e367f2dc2fdf7482022..92d0455737b2445fcbe746e51534788de8e10cc7 100644 (file)
@@ -216,7 +216,7 @@ int ctdb_control_recv(struct ctdb_context *ctdb,
    called when a control completes or timesout to invoke the callback
    function the user provided
 */
-static void invoke_control_callback(struct event_context *ev, struct timed_event *te, 
+void ctdb_invoke_control_callback(struct event_context *ev, struct timed_event *te, 
        struct timeval t, void *private_data)
 {
        struct ctdb_client_control_state *state;
@@ -278,7 +278,7 @@ static void ctdb_client_reply_control(struct ctdb_context *ctdb,
           and call the callback.
        */
        if (state->async.fn) {
-               event_add_timed(ctdb->ev, state, timeval_zero(), invoke_control_callback, state);
+               event_add_timed(ctdb->ev, state, timeval_zero(), ctdb_invoke_control_callback, state);
        }
 }
 
@@ -436,26 +436,6 @@ static int ctdb_client_queue_pkt(struct ctdb_context *ctdb, struct ctdb_req_head
 }
 
 
-/* time out handler for ctdb_control */
-static void control_timeout_func(struct event_context *ev, struct timed_event *te, 
-       struct timeval t, void *private_data)
-{
-       struct ctdb_client_control_state *state = talloc_get_type(private_data, struct ctdb_client_control_state);
-
-       DEBUG(DEBUG_ERR,(__location__ " control timed out. reqid:%u opcode:%u "
-                        "dstnode:%u\n", state->reqid, state->c->opcode,
-                        state->c->hdr.destnode));
-
-       state->state = CTDB_CONTROL_TIMEOUT;
-
-       /* if we had a callback registered for this control, pull the response
-          and call the callback.
-       */
-       if (state->async.fn) {
-               event_add_timed(state->ctdb->ev, state, timeval_zero(), invoke_control_callback, state);
-       }
-}
-
 /* async version of send control request */
 struct ctdb_client_control_state *ctdb_control_send(struct ctdb_context *ctdb, 
                uint32_t destnode, uint64_t srvid, 
@@ -506,7 +486,7 @@ struct ctdb_client_control_state *ctdb_control_send(struct ctdb_context *ctdb,
 
        /* timeout */
        if (timeout && !timeval_is_zero(timeout)) {
-               event_add_timed(ctdb->ev, state, *timeout, control_timeout_func, state);
+               event_add_timed(ctdb->ev, state, *timeout, ctdb_control_timeout_func, state);
        }
 
        ret = ctdb_client_queue_pkt(ctdb, &(c->hdr));