From: Date: Sat, 1 Dec 2007 07:33:46 +0000 (-0800) Subject: Fix in issue where no servers are to be found (introduced in last refactoring) X-Git-Tag: 0.13~59 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=3d2ba0693a28ce47e106018a65ebcca0a213731c;p=m6w6%2Flibmemcached Fix in issue where no servers are to be found (introduced in last refactoring) --- diff --git a/lib/memcached_storage.c b/lib/memcached_storage.c index 6672a86a..ee48cad3 100644 --- a/lib/memcached_storage.c +++ b/lib/memcached_storage.c @@ -62,6 +62,9 @@ static inline memcached_return memcached_send(memcached_st *ptr, if (key_length == 0) return MEMCACHED_NO_KEY_PROVIDED; + if (ptr->number_of_hosts == 0) + return MEMCACHED_NO_SERVERS; + server_key= memcached_generate_hash(ptr, key, key_length); if (cas) diff --git a/tests/function.c b/tests/function.c index 9cd10aff..5ececc5f 100644 --- a/tests/function.c +++ b/tests/function.c @@ -1225,13 +1225,16 @@ uint8_t user_supplied_bug6(memcached_st *memc) value= memcached_get(memc, keys[0], key_length[0], &value_length, &flags, &rc); assert(value == NULL); + assert(rc == MEMCACHED_NOTFOUND); rc= memcached_mget(memc, keys, key_length, 4); + assert(rc == MEMCACHED_SUCCESS); count= 0; while ((value= memcached_fetch(memc, return_key, &return_key_length, &value_length, &flags, &rc))) count++; assert(count == 0); + assert(rc == MEMCACHED_NOTFOUND); for (x= 0; x < 4; x++) { @@ -1249,12 +1252,15 @@ uint8_t user_supplied_bug6(memcached_st *memc) free(value); rc= memcached_mget(memc, keys, key_length, 4); + assert(rc == MEMCACHED_SUCCESS); count= 3; /* We test for purge of partial complete fetches */ for (count= 3; count; count--) { value= memcached_fetch(memc, return_key, &return_key_length, &value_length, &flags, &rc); + memcmp(value, insert_data, value_length); + assert(value_length); free(value); assert(rc == MEMCACHED_SUCCESS); }