X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fhosts.c;h=93f830a7cafa5a32f195a25fa27f2e723abbaa5b;hb=18ace40ddb7271f3f5e71965f74fe11d7754bd8f;hp=7e68766749e39fa0e1a2b5f97cd8bc37aee4d0d1;hpb=448b1915f70e5d7b637af23eb94193a26f759607;p=awesomized%2Flibmemcached diff --git a/libmemcached/hosts.c b/libmemcached/hosts.c index 7e687667..93f830a7 100644 --- a/libmemcached/hosts.c +++ b/libmemcached/hosts.c @@ -226,8 +226,8 @@ static memcached_return_t update_continuum(memcached_st *ptr) for (uint32_t x= 0; x < pointer_per_hash; x++) { uint32_t value= ketama_server_hash(sort_host, (size_t)sort_host_length, x); - ptr->ketama.continuum[continuum_index].index= host_index; - ptr->ketama.continuum[continuum_index++].value= value; + ptr->ketama.continuum[continuum_index].index= host_index; + ptr->ketama.continuum[continuum_index++].value= value; } } else @@ -274,9 +274,9 @@ static memcached_return_t update_continuum(memcached_st *ptr) { for (uint32_t x = 0; x < pointer_per_hash; x++) { - uint32_t value= ketama_server_hash(sort_host, (size_t)sort_host_length, x); - ptr->ketama.continuum[continuum_index].index= host_index; - ptr->ketama.continuum[continuum_index++].value= value; + uint32_t value= ketama_server_hash(sort_host, (size_t)sort_host_length, x); + ptr->ketama.continuum[continuum_index].index= host_index; + ptr->ketama.continuum[continuum_index++].value= value; } } else @@ -449,3 +449,20 @@ 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); +}