X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fmemcached.c;h=74e75706875451277f9971a9a163d97155a54d8e;hb=d5ffc30a6f369ea210e92e6a55333121d32b9a55;hp=31c12ab3158bc52af7665376171816157f27e3c5;hpb=8fce86636639afaeac4ca0e869e8bcd833324a62;p=m6w6%2Flibmemcached diff --git a/libmemcached/memcached.c b/libmemcached/memcached.c index 31c12ab3..74e75706 100644 --- a/libmemcached/memcached.c +++ b/libmemcached/memcached.c @@ -24,6 +24,8 @@ memcached_st *memcached_create(memcached_st *ptr) result_ptr= memcached_result_create(ptr, &ptr->result); WATCHPOINT_ASSERT(result_ptr); ptr->poll_timeout= MEMCACHED_DEFAULT_TIMEOUT; + ptr->connect_timeout= MEMCACHED_DEFAULT_TIMEOUT; + ptr->retry_timeout= 0; ptr->distribution= MEMCACHED_DISTRIBUTION_MODULA; return ptr; @@ -39,6 +41,22 @@ void memcached_free(memcached_st *ptr) if (ptr->on_cleanup) ptr->on_cleanup(ptr); + if (ptr->continuum) + { + if (ptr->call_free) + ptr->call_free(ptr, ptr->continuum); + else + free(ptr->continuum); + } + + if (ptr->wheel) + { + if (ptr->call_free) + ptr->call_free(ptr, ptr->wheel); + else + free(ptr->wheel); + } + if (ptr->is_allocated == MEMCACHED_ALLOCATED) { if (ptr->call_free) @@ -89,6 +107,8 @@ memcached_st *memcached_clone(memcached_st *clone, memcached_st *ptr) new_clone->send_size= ptr->send_size; new_clone->recv_size= ptr->recv_size; new_clone->poll_timeout= ptr->poll_timeout; + new_clone->connect_timeout= ptr->connect_timeout; + new_clone->retry_timeout= ptr->retry_timeout; new_clone->distribution= ptr->distribution; new_clone->hash= ptr->hash; new_clone->user_data= ptr->user_data; @@ -98,6 +118,19 @@ memcached_st *memcached_clone(memcached_st *clone, memcached_st *ptr) new_clone->call_free= ptr->call_free; new_clone->call_malloc= ptr->call_malloc; new_clone->call_realloc= ptr->call_realloc; + new_clone->get_key_failure= ptr->get_key_failure; + new_clone->delete_trigger= ptr->delete_trigger; + + if (ptr->prefix_key[0] != 0) + strcpy(new_clone->prefix_key, ptr->prefix_key); + + rc= run_distribution(new_clone); + if (rc != MEMCACHED_SUCCESS) + { + memcached_free(new_clone); + + return NULL; + } if (ptr->on_clone) ptr->on_clone(ptr, new_clone);