From: Date: Wed, 23 Apr 2008 12:13:18 +0000 (-0700) Subject: Added test for ketama. Fixed bug in setting behavior. X-Git-Tag: 0.20~1^2~4 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=0d870addf55a8ffaffdfa1c9ac851763f52e25c8;p=awesomized%2Flibmemcached Added test for ketama. Fixed bug in setting behavior. --- diff --git a/libmemcached/memcached_behavior.c b/libmemcached/memcached_behavior.c index aac63f42..e89473cf 100644 --- a/libmemcached/memcached_behavior.c +++ b/libmemcached/memcached_behavior.c @@ -44,17 +44,20 @@ memcached_return memcached_behavior_set(memcached_st *ptr, break; } case MEMCACHED_BEHAVIOR_KETAMA: - if (data) { - ptr->hash= MEMCACHED_HASH_MD5; - ptr->distribution= MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA; - } - else - { - ptr->hash= 0; - ptr->distribution= 0; + if (data) + { + ptr->hash= MEMCACHED_HASH_MD5; + ptr->distribution= MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA; + } + else + { + ptr->hash= 0; + ptr->distribution= 0; + } + run_distribution(ptr); + break; } - break; case MEMCACHED_BEHAVIOR_HASH: ptr->hash= (memcached_hash)(data); break; diff --git a/tests/function.c b/tests/function.c index 3f7e096e..cc63dadd 100644 --- a/tests/function.c +++ b/tests/function.c @@ -2723,6 +2723,7 @@ collection_st collection[] ={ {"user", 0, 0, user_tests}, {"generate", 0, 0, generate_tests}, {"generate_hsieh", pre_hsieh, 0, generate_tests}, + {"generate_ketama", pre_behavior_ketama, 0, generate_tests}, {"generate_hsieh_consistent", enable_consistent, 0, generate_tests}, {"generate_md5", pre_md5, 0, generate_tests}, {"generate_murmur", pre_murmur, 0, generate_tests},