- // Provides backwards compatibility with server list.
- {
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, 0);
- instance->number_of_hosts= memcached_server_count(ptr);
+ memcached_string_t hostname= { memcached_string_make_from_cstr(list[x].hostname) };
+ if (__instance_create_with(ptr, instance,
+ hostname,
+ list[x].port, list[x].weight, list[x].type) == NULL)
+ {
+ ptr->state.is_parsing= false;
+ return memcached_set_error(*ptr, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT);
+ }
+
+ if (list[x].weight > 1)
+ {
+ memcached_set_weighted_ketama(ptr, true);
+ }
+ }
+ ptr->state.is_parsing= false;
+
+ return run_distribution(ptr);