X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=inline;f=libmemcached%2Fmemcached_hosts.c;h=231b2167ba37b2f876e3527baea682eee73316c1;hb=92104790f8c3330d957f43aac5cc73134482fd83;hp=03ea81e37eb05fc9a71dc6a0d196719fb901a1fd;hpb=83d63a1f916b073f8cf44cf91b6c0b3d118dabe5;p=awesomized%2Flibmemcached diff --git a/libmemcached/memcached_hosts.c b/libmemcached/memcached_hosts.c index 03ea81e3..231b2167 100644 --- a/libmemcached/memcached_hosts.c +++ b/libmemcached/memcached_hosts.c @@ -121,7 +121,10 @@ void server_list_free(memcached_st *ptr, memcached_server_st *servers) for (x= 0; x < servers->count; x++) if (servers[x].address_info) + { freeaddrinfo(servers[x].address_info); + servers[x].address_info= NULL; + } if (ptr && ptr->call_free) ptr->call_free(ptr, servers); @@ -143,18 +146,6 @@ static int continuum_item_cmp(const void *t1, const void *t2) return -1; } -static uint32_t internal_generate_ketama_md5(char *key, size_t key_length) -{ - unsigned char results[16]; - - md5_signature((unsigned char*)key, (unsigned int)key_length, results); - - return ( (results[3] ) << 24) - | ( (results[2] ) << 16) - | ( (results[1] ) << 8) - | ( results[0] ); -} - memcached_return update_continuum(memcached_st *ptr) { uint32_t index; @@ -190,7 +181,7 @@ memcached_return update_continuum(memcached_st *ptr) sort_host_length= snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH, "%s:%d-%d", list[host_index].hostname, list[host_index].port, index); WATCHPOINT_ASSERT(sort_host_length); - value= internal_generate_ketama_md5(sort_host, sort_host_length); + value= generate_hash(ptr, sort_host, sort_host_length); ptr->continuum[continuum_index].index= host_index; ptr->continuum[continuum_index++].value= value; } @@ -230,7 +221,10 @@ memcached_return memcached_server_push(memcached_st *ptr, memcached_server_st *l sizeof(memcached_server_st) * (count + ptr->number_of_hosts)); if (!new_host_list) + { + assert(0); return MEMCACHED_MEMORY_ALLOCATION_FAILURE; + } ptr->hosts= new_host_list;