+ memcached_instance_set(ptr, new_host_list, host_list_size);
+
+ // We don't bother with lookups for this operation
+ ptr->state.is_parsing= true;
+
+ // We use original_host_size since size will now point to the first new
+ // instance allocated.
+ for (uint32_t x= 0; x < number_of_hosts; ++x, ++original_host_size)
+ {
+ WATCHPOINT_ASSERT(list[x]._hostname[0] != 0);
+
+ // We have extended the array, and now we will find it, and use it.
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, original_host_size);
+ 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)
+ {
+ 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;
+