The branch, libctdb has been updated
       via  8143148ebb2337ad8125aa97474b3ad1ce8bdeca (commit)
      from  90fb6caf1706454d8ec94f8022e61beb93a93f51 (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=libctdb


- Log -----------------------------------------------------------------
commit 8143148ebb2337ad8125aa97474b3ad1ce8bdeca
Author: Ronnie Sahlberg <[email protected]>
Date:   Tue May 18 16:07:42 2010 +1000

    Add verification that we called the correct *_recv() function for the 
handle from the callbacks and elsewhere.

-----------------------------------------------------------------------

Summary of changes:
 libctdb/libctdb.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libctdb/libctdb.c b/libctdb/libctdb.c
index 9fe55a9..c9cc4d8 100644
--- a/libctdb/libctdb.c
+++ b/libctdb/libctdb.c
@@ -51,7 +51,7 @@ ctdb_control_cb(struct ctdb_client_control_state *state)
        state->async.fn = NULL;
 
        if (state->state != CTDB_CONTROL_DONE) {
-               DEBUG(DEBUG_ERR, (__location__ " ctdb_getpnn_recv_cb failed 
with state:%d\n", state->state));
+               DEBUG(DEBUG_ERR, (__location__ " ctdb_control_cb failed with 
state:%d\n", state->state));
                callback(-1, NULL, NULL, cb_data->private_data);
                return;
        }
@@ -268,6 +268,10 @@ int ctdb_getpnn_recv(struct ctdb_context *ctdb, 
ctdb_handle *handle, uint32_t *p
        struct ctdb_client_control_state *state = talloc_get_type(handle, 
struct ctdb_client_control_state);
        int ret;
 
+       if (state->c->opcode != CTDB_CONTROL_GET_PNN) {
+               DEBUG(DEBUG_ERR, (__location__ " Unexpected opcode for 
control_recv. Expected %d but got %d\n", CTDB_CONTROL_GET_PNN, 
state->c->opcode));
+               return -1;
+       }
        ret = ctdb_control_recv(ctdb, state, state, NULL, NULL, NULL);
        if (ret != 0) {
                DEBUG(DEBUG_ERR,(__location__ " ctdb_getpnn_recv failed\n"));
@@ -328,6 +332,11 @@ int ctdb_getrecmaster_recv(struct ctdb_context *ctdb, 
ctdb_handle *handle, uint3
        struct ctdb_client_control_state *state = talloc_get_type(handle, 
struct ctdb_client_control_state);
        int ret;
 
+       if (state->c->opcode != CTDB_CONTROL_GET_RECMASTER) {
+               DEBUG(DEBUG_ERR, (__location__ " Unexpected opcode for 
control_recv. Expected %d but got %d\n", CTDB_CONTROL_GET_RECMASTER, 
state->c->opcode));
+               return -1;
+       }
+
        ret = ctdb_control_recv(ctdb, state, state, NULL, NULL, NULL);
        if (ret != 0) {
                DEBUG(DEBUG_ERR,(__location__ " ctdb_getrecmaster_recv 
failed\n"));


-- 
CTDB repository

Reply via email to