X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fauto.cc;h=eae44a9032f646284424cb7e2267924ab9dbc5e7;hb=9351ece659f57ee704b5f0ccfd4b531677ff36f8;hp=85e2ae091ace02aae5822f8d16f5a91bf533ccc1;hpb=5086fce85b544731a8cf3c0d2c3dbb478ed90c43;p=awesomized%2Flibmemcached diff --git a/libmemcached/auto.cc b/libmemcached/auto.cc index 85e2ae09..eae44a90 100644 --- a/libmemcached/auto.cc +++ b/libmemcached/auto.cc @@ -37,7 +37,7 @@ #include -static void auto_response(org::libmemcached::Instance* instance, const bool reply, memcached_return_t& rc, uint64_t* value) +static void auto_response(memcached_instance_st* instance, const bool reply, memcached_return_t& rc, uint64_t* value) { // If the message was successfully sent, then get the response, otherwise // fail. @@ -57,13 +57,18 @@ static void auto_response(org::libmemcached::Instance* instance, const bool repl assert(memcached_last_error(instance->root) != MEMCACHED_SUCCESS); *value= UINT64_MAX; } + else if (memcached_failed(rc)) + { + *value= UINT64_MAX; + } else { + assert(memcached_last_error(instance->root) != MEMCACHED_NOTFOUND); *value= instance->root->result.numeric_value; } } -static memcached_return_t text_incr_decr(org::libmemcached::Instance* instance, +static memcached_return_t text_incr_decr(memcached_instance_st* instance, const bool is_incr, const char *key, size_t key_length, const uint64_t offset, @@ -97,7 +102,7 @@ static memcached_return_t text_incr_decr(org::libmemcached::Instance* instance, return memcached_vdo(instance, vector, 7, true); } -static memcached_return_t binary_incr_decr(org::libmemcached::Instance* instance, +static memcached_return_t binary_incr_decr(memcached_instance_st* instance, protocol_binary_command cmd, const char *key, const size_t key_length, const uint64_t offset, @@ -180,7 +185,7 @@ static memcached_return_t increment_decrement_by_key(const protocol_binary_comma } uint32_t server_key= memcached_generate_hash_with_redistribution(memc, group_key, group_key_length); - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, server_key); + memcached_instance_st* instance= memcached_instance_fetch(memc, server_key); bool reply= memcached_is_replying(instance->root); @@ -239,7 +244,7 @@ static memcached_return_t increment_decrement_with_initial_by_key(const protocol } uint32_t server_key= memcached_generate_hash_with_redistribution(memc, group_key, group_key_length); - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, server_key); + memcached_instance_st* instance= memcached_instance_fetch(memc, server_key); bool reply= memcached_is_replying(instance->root);