X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fpurge.cc;h=4dbe24d05cb090e733f6d1a07d2b197c92d28af3;hb=9973d386ac8476cd09cc4d9cf7bd2234a42740c7;hp=b1390d9c1aa502339764effc0a1f0cc1038b7494;hpb=c5bd49aee7b7bcb434cc526ff67d4bccddd4ba90;p=awesomized%2Flibmemcached diff --git a/libmemcached/purge.cc b/libmemcached/purge.cc index b1390d9c..4dbe24d0 100644 --- a/libmemcached/purge.cc +++ b/libmemcached/purge.cc @@ -79,7 +79,7 @@ private: int32_t& _origin; }; -bool memcached_purge(org::libmemcached::Instance* ptr) +bool memcached_purge(memcached_instance_st* ptr) { Memcached *root= (Memcached *)ptr->root; @@ -105,14 +105,15 @@ bool memcached_purge(org::libmemcached::Instance* ptr) */ if (memcached_io_write(ptr) == false) { + memcached_io_reset(ptr); memcached_set_error(*ptr, MEMCACHED_WRITE_FAILURE, MEMCACHED_AT); return false; } WATCHPOINT_ASSERT(ptr->fd != INVALID_SOCKET); bool is_successful= true; - uint32_t no_msg= memcached_server_response_count(ptr) - 1; - if (no_msg > 0) + uint32_t no_msg= memcached_server_response_count(ptr); + if (no_msg > 1) { memcached_result_st result; @@ -126,7 +127,7 @@ bool memcached_purge(org::libmemcached::Instance* ptr) memcached_result_st* result_ptr= memcached_result_create(root, &result); assert(result_ptr); - for (uint32_t x= 0; x < no_msg; x++) + for (uint32_t x= 0; x < no_msg - 1; x++) { memcached_result_reset(result_ptr); memcached_return_t rc= memcached_read_one_response(ptr, result_ptr); @@ -138,7 +139,6 @@ bool memcached_purge(org::libmemcached::Instance* ptr) if (rc== MEMCACHED_PROTOCOL_ERROR or rc == MEMCACHED_UNKNOWN_READ_FAILURE or rc == MEMCACHED_READ_FAILURE) { WATCHPOINT_ERROR(rc); - memcached_io_reset(ptr); is_successful= false; }