- memcached_server_write_instance_st instance;
- instance= memcached_server_instance_fetch(ptr, 0);
- instance->number_of_hosts= memcached_server_count(ptr);
+ return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
+ }
+
+ memcached_instance_set(ptr, new_host_list);
+
+ for (uint32_t x= 0; x < number_of_hosts; x++)
+ {
+
+ WATCHPOINT_ASSERT(list[x].hostname[0] != 0);
+
+ // We have extended the array, and now we will find it, and use it.
+ org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, memcached_server_count(ptr));
+ WATCHPOINT_ASSERT(instance);
+
+ 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)
+ {
+ return memcached_set_error(*ptr, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT);
+ }
+
+ if (list[x].weight > 1)
+ {
+ memcached_set_weighted_ketama(ptr, true);
+ }
+
+ ptr->number_of_hosts++;