diff options
author | Volker Lendecke <vl@samba.org> | 2011-08-18 13:55:24 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-08-22 17:11:06 +0200 |
commit | a31d7516f5c6c1814e9f16645149eb597580dbef (patch) | |
tree | 8cf1cbaa668fc80bc95739fa71603259980480b6 | |
parent | 19f31f86ac40d0bcd7ad652245308b365e7a7979 (diff) | |
download | samba-a31d7516f5c6c1814e9f16645149eb597580dbef.tar.gz samba-a31d7516f5c6c1814e9f16645149eb597580dbef.tar.xz samba-a31d7516f5c6c1814e9f16645149eb597580dbef.zip |
libctdb: Reorder set_message_handler
No code change, this is for better readability
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit e0f93459e05eef33024096654b4aaf1eb3c6d7c4)
-rw-r--r-- | ctdb/libctdb/messages.c | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/ctdb/libctdb/messages.c b/ctdb/libctdb/messages.c index d61d29e16f..737d255940 100644 --- a/ctdb/libctdb/messages.c +++ b/ctdb/libctdb/messages.c @@ -57,34 +57,7 @@ void remove_message_handlers(struct ctdb_connection *ctdb) } } -bool ctdb_set_message_handler_recv(struct ctdb_connection *ctdb, - struct ctdb_request *req) -{ - struct message_handler_info *info = req->extra; - struct ctdb_reply_control *reply; - - reply = unpack_reply_control(ctdb, req, CTDB_CONTROL_REGISTER_SRVID); - if (!reply) { - return false; - } - if (reply->status != 0) { - DEBUG(ctdb, LOG_ERR, - "ctdb_set_message_handler_recv: status %i", - reply->status); - return false; - } - - /* Put ourselves in list of handlers. */ - DLIST_ADD(ctdb->message_handlers, info); - /* Keep safe from destructor */ - req->extra = NULL; - return true; -} - -static void free_info(struct ctdb_connection *ctdb, struct ctdb_request *req) -{ - free(req->extra); -} +static void free_info(struct ctdb_connection *ctdb, struct ctdb_request *req); struct ctdb_request * ctdb_set_message_handler_send(struct ctdb_connection *ctdb, uint64_t srvid, @@ -124,6 +97,35 @@ ctdb_set_message_handler_send(struct ctdb_connection *ctdb, uint64_t srvid, return req; } +static void free_info(struct ctdb_connection *ctdb, struct ctdb_request *req) +{ + free(req->extra); +} + +bool ctdb_set_message_handler_recv(struct ctdb_connection *ctdb, + struct ctdb_request *req) +{ + struct message_handler_info *info = req->extra; + struct ctdb_reply_control *reply; + + reply = unpack_reply_control(ctdb, req, CTDB_CONTROL_REGISTER_SRVID); + if (!reply) { + return false; + } + if (reply->status != 0) { + DEBUG(ctdb, LOG_ERR, + "ctdb_set_message_handler_recv: status %i", + reply->status); + return false; + } + + /* Put ourselves in list of handlers. */ + DLIST_ADD(ctdb->message_handlers, info); + /* Keep safe from destructor */ + req->extra = NULL; + return true; +} + struct ctdb_request * ctdb_remove_message_handler_send(struct ctdb_connection *ctdb, uint64_t srvid, ctdb_message_fn_t handler, void *hdata, |