X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fstorage.cc;h=1b3dbcddd7cd15e220db0b11d5884ef54820931a;hb=3337fe07860804ea2654aa53e9ecdf9470434016;hp=0ce4ea61a3f939b7aadfc93a10122cfac16e7b17;hpb=26ec654470aafe3772c2c7817f7089e95aabed4d;p=m6w6%2Flibmemcached diff --git a/libmemcached/storage.cc b/libmemcached/storage.cc index 0ce4ea61..1b3dbcdd 100644 --- a/libmemcached/storage.cc +++ b/libmemcached/storage.cc @@ -290,20 +290,22 @@ static memcached_return_t memcached_send_ascii(memcached_st *ptr, /* Send command header */ memcached_return_t rc= memcached_vdo(instance, vector, 12, flush); - if (rc == MEMCACHED_SUCCESS) + + // If we should not reply, return with MEMCACHED_SUCCESS, unless error + if (reply == false) { - if (flush == false) - { - return MEMCACHED_BUFFERED; - } + return memcached_success(rc) ? MEMCACHED_SUCCESS : rc; + } - if (reply == false) - { - return MEMCACHED_SUCCESS; - } + if (flush == false) + { + return memcached_success(rc) ? MEMCACHED_BUFFERED : rc; + } + if (rc == MEMCACHED_SUCCESS) + { char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE]; - rc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL); + rc= memcached_response(instance, buffer, sizeof(buffer), NULL); if (rc == MEMCACHED_STORED) { @@ -340,14 +342,9 @@ static inline memcached_return_t memcached_send(memcached_st *ptr, return rc; } - if (memcached_failed(rc= memcached_validate_key_length(key_length, memcached_is_binary(ptr)))) - { - return rc; - } - if (memcached_failed(memcached_key_test(*ptr, (const char **)&key, &key_length, 1))) { - return MEMCACHED_BAD_KEY_PROVIDED; + return memcached_last_error(ptr); } uint32_t server_key= memcached_generate_hash_with_redistribution(ptr, group_key, group_key_length);