summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrond Norbye <trond.norbye@gmail.com>2011-04-14 16:07:14 +0200
committerTrond Norbye <trond.norbye@gmail.com>2011-04-19 09:43:27 +0200
commit55627b40c47c302980e371719a59babc9453628a (patch)
tree936bd88ff4668279551d18b2bd1f91483056998c
parentcc3941084188195fc8b43fcdc05cec3dab5a4bd4 (diff)
downloadmemcached-55627b40c47c302980e371719a59babc9453628a.tar.gz
Reserve/release cookie should be able to return errors
A proxy-engine may want to intercept the calls and should be able to return an error.
-rw-r--r--daemon/memcached.c6
-rw-r--r--include/memcached/server_api.h4
-rw-r--r--programs/mock_server.c6
3 files changed, 10 insertions, 6 deletions
diff --git a/daemon/memcached.c b/daemon/memcached.c
index 299f502..d3c9cec 100644
--- a/daemon/memcached.c
+++ b/daemon/memcached.c
@@ -6294,14 +6294,16 @@ static void set_tap_nack_mode(const void *cookie, bool enable) {
c->tap_nack_mode = enable;
}
-static void reserve_cookie(const void *cookie) {
+static ENGINE_ERROR_CODE reserve_cookie(const void *cookie) {
conn *c = (conn *)cookie;
++c->refcount;
+ return ENGINE_SUCCESS;
}
-static void release_cookie(const void *cookie) {
+static ENGINE_ERROR_CODE release_cookie(const void *cookie) {
conn *c = (conn *)cookie;
--c->refcount;
+ return ENGINE_SUCCESS;
}
static int num_independent_stats(void) {
diff --git a/include/memcached/server_api.h b/include/memcached/server_api.h
index 8240c65..847640f 100644
--- a/include/memcached/server_api.h
+++ b/include/memcached/server_api.h
@@ -146,14 +146,14 @@ extern "C" {
* future use. (The core guarantees it will not invalidate the
* memory until the cookie is invalidated by calling release())
*/
- void (*reserve)(const void *cookie);
+ ENGINE_ERROR_CODE (*reserve)(const void *cookie);
/**
* Notify the core that we're releasing the reference to the
* The engine is not allowed to use the cookie (the core may invalidate
* the memory)
*/
- void (*release)(const void *cookie);
+ ENGINE_ERROR_CODE (*release)(const void *cookie);
} SERVER_COOKIE_API;
diff --git a/programs/mock_server.c b/programs/mock_server.c
index b05eeb5..0213307 100644
--- a/programs/mock_server.c
+++ b/programs/mock_server.c
@@ -63,12 +63,14 @@ static void mock_set_tap_nack_mode(const void *cookie, bool enable) {
(void)enable;
}
-static void mock_cookie_reserve(const void *cookie) {
+static ENGINE_ERROR_CODE mock_cookie_reserve(const void *cookie) {
(void)cookie;
+ return ENGINE_SUCCESS;
}
-static void mock_cookie_release(const void *cookie) {
+static ENGINE_ERROR_CODE mock_cookie_release(const void *cookie) {
(void)cookie;
+ return ENGINE_SUCCESS;
}
static const char *mock_get_server_version() {