[SCM] CTDB repository - branch master updated - ctdb-1.0.114-122-g573e4e2
Ronnie Sahlberg
sahlberg at samba.org
Tue Jun 1 21:52:20 MDT 2010
The branch, master has been updated
via 573e4e2d2bd09dd9579150cce926de774a0b609c (commit)
from 2b3904d3113737d57ac0ec78f33ad163ed7f623c (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 573e4e2d2bd09dd9579150cce926de774a0b609c
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jun 2 13:49:34 2010 +1000
Make the call to free the request explicit in the callback
instead of implicit
-----------------------------------------------------------------------
Summary of changes:
include/ctdb.h | 7 ++++---
libctdb/ctdb.c | 2 +-
libctdb/tst.c | 3 +++
3 files changed, 8 insertions(+), 4 deletions(-)
Changeset truncated at 500 lines:
diff --git a/include/ctdb.h b/include/ctdb.h
index 040cd0c..32a7a2c 100644
--- a/include/ctdb.h
+++ b/include/ctdb.h
@@ -26,13 +26,13 @@
#include <tdb.h>
/* All *_send() functions are guaranteed to be non-blocking and fully
- * asynchronous. The non-_send variants are synchronous. */
+ * asynchronous. The non-_send variants are synchronous.
+ */
/*
* Connect to ctdb using the specified domain socket.
* Returns a ctdb context if successful or NULL.
*
- * Use ctdb_free() to release the returned ctdb_connection when finished.
*/
struct ctdb_connection *ctdb_connect(const char *addr);
@@ -48,7 +48,8 @@ void ctdb_request_free(struct ctdb_request *req);
/*
* Callback for completed requests: it would normally unpack the request
- * using ctdb_*_recv(). You must free the request using ctdb_request_free().
+ * using ctdb_*_recv().
+ * You must free the request using ctdb_request_free().
*
* Note that due to macro magic, your callback doesn't have to take void *,
* it can take a type which matches the actual private parameter.
diff --git a/libctdb/ctdb.c b/libctdb/ctdb.c
index 08355ef..e49e3d8 100644
--- a/libctdb/ctdb.c
+++ b/libctdb/ctdb.c
@@ -75,6 +75,7 @@ static void set_pnn(struct ctdb_connection *ctdb,
/* FIXME: Report error. */
ctdb->broken = true;
}
+ ctdb_request_free(req);
}
struct ctdb_connection *ctdb_connect(const char *addr)
@@ -240,7 +241,6 @@ static void handle_incoming(struct ctdb_connection *ctdb, struct io_elem *in)
DLIST_REMOVE(ctdb->doneq, i);
i->reply = in;
i->callback(ctdb, i, i->priv_data);
- ctdb_request_free(i);
return;
}
}
diff --git a/libctdb/tst.c b/libctdb/tst.c
index af23a56..6fd376a 100644
--- a/libctdb/tst.c
+++ b/libctdb/tst.c
@@ -50,6 +50,7 @@ static void pnn_cb(struct ctdb_connection *ctdb,
uint32_t pnn;
status = ctdb_getpnn_recv(req, &pnn);
+ ctdb_request_free(req);
if (status != 0) {
printf("Error reading PNN\n");
return;
@@ -64,6 +65,7 @@ static void rm_cb(struct ctdb_connection *ctdb,
uint32_t rm;
status = ctdb_getrecmaster_recv(req, &rm);
+ ctdb_request_free(req);
if (status != 0) {
printf("Error reading RECMASTER\n");
return;
@@ -118,6 +120,7 @@ void message_handler_cb(struct ctdb_connection *ctdb,
if (ctdb_set_message_handler_recv(ctdb, req) != 0) {
err(1, "registering message");
}
+ ctdb_request_free(req);
printf("Message handler registered\n");
registered = true;
}
--
CTDB repository
More information about the samba-cvs
mailing list