X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fhosts.cc;h=1852e540eca11ecd87f6623fc371cd87b8065203;hb=a6c3e3a3d04f379b1480c8c88a8eae17e54b1449;hp=4aee163cda51781d665c2422fe807b70342a1e4c;hpb=08cb9372fc4a1c660aeac3a89c5fe066538e8624;p=awesomized%2Flibmemcached diff --git a/libmemcached/hosts.cc b/libmemcached/hosts.cc index 4aee163c..1852e540 100644 --- a/libmemcached/hosts.cc +++ b/libmemcached/hosts.cc @@ -259,8 +259,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 @@ -307,9 +307,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 @@ -494,3 +494,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); +}