From: Ronnie Sahlberg Date: Thu, 13 May 2010 02:16:00 +0000 (+1000) Subject: change the old ctdb_ctrl_getpnn() function with tiemout use the new X-Git-Url: http://git.samba.org/?p=sahlberg%2Fctdb.git;a=commitdiff_plain;h=f5ca198445ec9b6c6e989c52057a46c144e3a033 change the old ctdb_ctrl_getpnn() function with tiemout use the new libctdb functions instead of calling ctdb_control() directly. --- diff --git a/client/ctdb_client.c b/client/ctdb_client.c index 7b499311..a3349e0b 100644 --- a/client/ctdb_client.c +++ b/client/ctdb_client.c @@ -1393,17 +1393,26 @@ int ctdb_ctrl_thaw(struct ctdb_context *ctdb, struct timeval timeout, uint32_t d int ctdb_ctrl_getpnn(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode) { int ret; - int32_t res; + uint32_t pnn; + ctdb_handle *handle; - ret = ctdb_control(ctdb, destnode, 0, - CTDB_CONTROL_GET_PNN, 0, tdb_null, - NULL, NULL, &res, &timeout, NULL); + handle = ctdb_getpnn_send(ctdb, destnode, NULL, NULL); + if (handle == NULL) { + DEBUG(DEBUG_ERR, (__location__ " Failed to send getpnn control\n")); + return -1; + } + + if (!timeval_is_zero(&timeout)) { + event_add_timed(ctdb->ev, handle, timeout, ctdb_control_timeout_func, handle); + } + + ret = ctdb_getpnn_recv(ctdb, handle, &pnn); if (ret != 0) { DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpnn failed\n")); return -1; } - return res; + return pnn; } /*