X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fmemcached.cc;h=cd0768eb957bce67341c97cc09820c440dddfa33;hb=983523c4536f12781533124cb8a00a4291b8cf79;hp=3201c99c3e61be286b17f676b779aef51c7c27a1;hpb=92c077c9151360149e5a18a0adc222baa234ec80;p=m6w6%2Flibmemcached diff --git a/libmemcached/memcached.cc b/libmemcached/memcached.cc index 3201c99c..cd0768eb 100644 --- a/libmemcached/memcached.cc +++ b/libmemcached/memcached.cc @@ -40,31 +40,6 @@ #include #include -#if 0 -static const memcached_st global_copy= { - .state= { - .is_purging= false, // .is_purging - .is_processing_input= false, // is_processing_input - .is_time_for_rebuild= false, - }, - .flags= { - .auto_eject_hosts= false, - .binary_protocol= false, - .buffer_requests= false, - .hash_with_namespace= false, - .no_block= false, - .no_reply= false, - .randomize_replica_read= false, - .support_cas= false, - .tcp_nodelay= false, - .use_sort_hosts= false, - .use_udp= false, - .verify_key= false, - .tcp_keepalive= false, - }, -}; -#endif - static inline bool _memcached_init(memcached_st *self) { self->state.is_purging= false; @@ -76,7 +51,7 @@ static inline bool _memcached_init(memcached_st *self) self->flags.buffer_requests= false; self->flags.hash_with_namespace= false; self->flags.no_block= false; - self->flags.no_reply= false; + self->flags.reply= true; self->flags.randomize_replica_read= false; self->flags.support_cas= false; self->flags.tcp_nodelay= false; @@ -87,7 +62,7 @@ static inline bool _memcached_init(memcached_st *self) self->virtual_bucket= NULL; - self->distribution= MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY; + self->distribution= MEMCACHED_DISTRIBUTION_MODULA; if (hashkit_create(&self->hashkit) == NULL) { @@ -121,6 +96,7 @@ static inline bool _memcached_init(memcached_st *self) self->poll_timeout= MEMCACHED_DEFAULT_TIMEOUT; self->connect_timeout= MEMCACHED_DEFAULT_CONNECT_TIMEOUT; self->retry_timeout= MEMCACHED_SERVER_FAILURE_RETRY_TIMEOUT; + self->dead_timeout= MEMCACHED_SERVER_FAILURE_DEAD_TIMEOUT; self->send_size= -1; self->recv_size= -1; @@ -182,7 +158,9 @@ static void _free(memcached_st *ptr, bool release_st) ptr->configure.filename= NULL; } - if (memcached_is_allocated(ptr) && release_st) + hashkit_free(&ptr->hashkit); + + if (memcached_is_allocated(ptr) and release_st) { libmemcached_free(ptr, ptr); } @@ -259,7 +237,7 @@ memcached_st *memcached(const char *string, size_t length) memcached_return_t memcached_reset(memcached_st *ptr) { WATCHPOINT_ASSERT(ptr); - if (not ptr) + if (ptr == NULL) { return MEMCACHED_INVALID_ARGUMENTS; } @@ -339,6 +317,7 @@ memcached_st *memcached_clone(memcached_st *clone, const memcached_st *source) new_clone->poll_timeout= source->poll_timeout; new_clone->connect_timeout= source->connect_timeout; new_clone->retry_timeout= source->retry_timeout; + new_clone->dead_timeout= source->dead_timeout; new_clone->distribution= source->distribution; if (hashkit_clone(&new_clone->hashkit, &source->hashkit) == NULL) @@ -377,6 +356,7 @@ memcached_st *memcached_clone(memcached_st *clone, const memcached_st *source) new_clone->_namespace= memcached_array_clone(new_clone, source->_namespace); new_clone->configure.filename= memcached_array_clone(new_clone, source->_namespace); + new_clone->configure.version= source->configure.version; if (LIBMEMCACHED_WITH_SASL_SUPPORT and source->sasl.callbacks) {