From: Trond Norbye Date: Thu, 19 Mar 2009 14:56:16 +0000 (+0100) Subject: Copy all tunable members in memcached_clone and add test case to verify X-Git-Tag: 0.27~12 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=ccb1b4c4c320b20b045de17719dd51a3fdec8d2c;p=m6w6%2Flibmemcached Copy all tunable members in memcached_clone and add test case to verify --- diff --git a/libmemcached/memcached.c b/libmemcached/memcached.c index a15cd2f2..5f8f308b 100644 --- a/libmemcached/memcached.c +++ b/libmemcached/memcached.c @@ -81,9 +81,9 @@ memcached_st *memcached_clone(memcached_st *clone, memcached_st *source) { return NULL; } - + new_clone= memcached_create(clone); - + if (new_clone == NULL) return NULL; @@ -108,6 +108,9 @@ memcached_st *memcached_clone(memcached_st *clone, memcached_st *source) new_clone->call_realloc= source->call_realloc; new_clone->get_key_failure= source->get_key_failure; new_clone->delete_trigger= source->delete_trigger; + new_clone->server_failure_limit= source->server_failure_limit; + new_clone->io_msg_watermark= source->io_msg_watermark; + new_clone->io_bytes_watermark= source->io_bytes_watermark; if (source->hosts) rc= memcached_server_push(new_clone, source->hosts); diff --git a/tests/function.c b/tests/function.c index 91c12f7a..40415daf 100644 --- a/tests/function.c +++ b/tests/function.c @@ -204,6 +204,30 @@ static test_return clone_test(memcached_st *memc) memcached_st *clone; clone= memcached_clone(NULL, memc); assert(clone); + + assert(clone->call_free == memc->call_free); + assert(clone->call_malloc == memc->call_malloc); + assert(clone->call_realloc == memc->call_realloc); + assert(clone->connect_timeout == memc->connect_timeout); + assert(clone->delete_trigger == memc->delete_trigger); + assert(clone->distribution == memc->distribution); + assert(clone->flags == memc->flags); + assert(clone->get_key_failure == memc->get_key_failure); + assert(clone->hash == memc->hash); + assert(clone->hash_continuum == memc->hash_continuum); + assert(clone->io_bytes_watermark == memc->io_bytes_watermark); + assert(clone->io_msg_watermark == memc->io_msg_watermark); + assert(clone->on_cleanup == memc->on_cleanup); + assert(clone->on_clone == memc->on_clone); + assert(clone->poll_timeout == memc->poll_timeout); + assert(clone->rcv_timeout == memc->rcv_timeout); + assert(clone->recv_size == memc->recv_size); + assert(clone->retry_timeout == memc->retry_timeout); + assert(clone->send_size == memc->send_size); + assert(clone->server_failure_limit == memc->server_failure_limit); + assert(clone->snd_timeout == memc->snd_timeout); + assert(clone->user_data == memc->user_data); + memcached_free(clone); }