X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fhash.cc;h=42e4698930fc716a3327dab75e1c3715bcc060ae;hb=ec18b17736a6e0ce98994daf5a6576e9658e4a1d;hp=5eca0c6f9eb9f4fb6f0381c34c14951f752490a5;hpb=a6c3e3a3d04f379b1480c8c88a8eae17e54b1449;p=m6w6%2Flibmemcached diff --git a/libmemcached/hash.cc b/libmemcached/hash.cc index 5eca0c6f..42e46989 100644 --- a/libmemcached/hash.cc +++ b/libmemcached/hash.cc @@ -62,9 +62,8 @@ static uint32_t dispatch_host(const memcached_st *ptr, uint32_t hash) case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY: { uint32_t num= ptr->ketama.continuum_points_counter; - WATCHPOINT_ASSERT(ptr->continuum); + WATCHPOINT_ASSERT(ptr->ketama.continuum); - hash= hash; memcached_continuum_item_st *begin, *end, *left, *right, *middle; begin= left= ptr->ketama.continuum; end= right= ptr->ketama.continuum + num; @@ -107,16 +106,16 @@ static inline uint32_t _generate_hash_wrapper(const memcached_st *ptr, const cha if (memcached_server_count(ptr) == 1) return 0; - if (ptr->flags.hash_with_prefix_key) + if (ptr->flags.hash_with_namespace) { - size_t temp_length= memcached_array_size(ptr->prefix_key) + key_length; + size_t temp_length= memcached_array_size(ptr->_namespace) + key_length; char temp[MEMCACHED_MAX_KEY]; if (temp_length > MEMCACHED_MAX_KEY -1) return 0; - strncpy(temp, memcached_array_string(ptr->prefix_key), memcached_array_size(ptr->prefix_key)); - strncpy(temp + memcached_array_size(ptr->prefix_key), key, key_length); + strncpy(temp, memcached_array_string(ptr->_namespace), memcached_array_size(ptr->_namespace)); + strncpy(temp + memcached_array_size(ptr->_namespace), key, key_length); return generate_hash(ptr, temp, temp_length); } @@ -132,7 +131,7 @@ static inline void _regen_for_auto_eject(memcached_st *ptr) { struct timeval now; - if (gettimeofday(&now, NULL) == 0 && + if (gettimeofday(&now, NULL) == 0 and now.tv_sec > ptr->ketama.next_distribution_rebuild) { run_distribution(ptr);