From: Trond Norbye Date: Fri, 18 Dec 2009 12:07:20 +0000 (+0100) Subject: Fix problem with bumping the command counter _before_ connecting to the server X-Git-Tag: 0.37~56^2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=015acfbd94575175d5af15c583e10cb5f67b202d;p=awesomized%2Flibmemcached Fix problem with bumping the command counter _before_ connecting to the server --- diff --git a/libmemcached/connect.c b/libmemcached/connect.c index 96f26fb8..e58e37fc 100644 --- a/libmemcached/connect.c +++ b/libmemcached/connect.c @@ -208,6 +208,8 @@ static memcached_return_t network_connect(memcached_server_st *ptr) { struct addrinfo *use; + WATCHPOINT_ASSERT(ptr->cursor_active == 0); + if (!ptr->sockaddr_inited || (!(ptr->root->flags.use_cache_lookups))) { @@ -282,7 +284,6 @@ static memcached_return_t network_connect(memcached_server_st *ptr) if (ptr->fd != -1) { - WATCHPOINT_ASSERT(ptr->cursor_active == 0); ptr->server_failure_counter= 0; return MEMCACHED_SUCCESS; } diff --git a/libmemcached/delete.c b/libmemcached/delete.c index bbdd2527..8250d58e 100644 --- a/libmemcached/delete.c +++ b/libmemcached/delete.c @@ -59,6 +59,14 @@ memcached_return_t memcached_delete_by_key(memcached_st *ptr, } else { + /* ensure that we are connected, otherwise we might bump the + * command counter before connection */ + if ((rc= memcached_connect(&ptr->hosts[server_key])) != MEMCACHED_SUCCESS) + { + WATCHPOINT_ERROR(rc); + return rc; + } + if (ptr->hosts[server_key].minor_version == 0) { if (no_reply || !to_write)