X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fhosts.c;h=eafbb1b534ca083e76cb76fc75698403047549fe;hb=347598f61d421d797468d8b2c86d5d8280cae90c;hp=67ba6d19829ba466be2a6ac9c0545e8e66d1ef9d;hpb=82b419129b70ae58c92b087a99ae1757743f54d5;p=m6w6%2Flibmemcached diff --git a/libmemcached/hosts.c b/libmemcached/hosts.c index 67ba6d19..eafbb1b5 100644 --- a/libmemcached/hosts.c +++ b/libmemcached/hosts.c @@ -109,7 +109,6 @@ static memcached_return_t update_continuum(memcached_st *ptr) uint32_t pointer_counter= 0; uint32_t pointer_per_server= MEMCACHED_POINTS_PER_SERVER; uint32_t pointer_per_hash= 1; - uint64_t total_weight= 0; uint32_t live_servers= 0; struct timeval now; @@ -163,16 +162,15 @@ static memcached_return_t update_continuum(memcached_st *ptr) ptr->ketama.continuum_count= live_servers + MEMCACHED_CONTINUUM_ADDITION; } + uint64_t total_weight= 0; if (is_ketama_weighted) { for (uint32_t host_index = 0; host_index < memcached_server_count(ptr); ++host_index) { - if (list[host_index].weight == 0) - { - list[host_index].weight = 1; - } if (! is_auto_ejecting || list[host_index].next_retry <= now.tv_sec) + { total_weight += list[host_index].weight; + } } } @@ -446,20 +444,3 @@ static memcached_return_t server_add(memcached_st *ptr, const char *hostname, return run_distribution(ptr); } - -memcached_return_t memcached_server_add_parsed(memcached_st *ptr, - const char *hostname, - size_t hostname_length, - in_port_t port, - uint32_t weight) -{ - char buffer[NI_MAXHOST]; - - memcpy(buffer, hostname, hostname_length); - buffer[hostname_length]= 0; - - return server_add(ptr, buffer, - port, - weight, - MEMCACHED_CONNECTION_TCP); -}