- return server_add(ptr, hostname, port, weight, MEMCACHED_CONNECTION_TCP);
-}
-
-static memcached_return_t server_add(memcached_st *ptr, const char *hostname,
- in_port_t port,
- uint32_t weight,
- memcached_connection_t type)
-{
- memcached_server_st *new_host_list;
- memcached_server_write_instance_st instance;
-
- if ( (ptr->flags.use_udp && type != MEMCACHED_CONNECTION_UDP)
- || ( (type == MEMCACHED_CONNECTION_UDP) && (! ptr->flags.use_udp) ) )
- return MEMCACHED_INVALID_HOST_PROTOCOL;
-
- new_host_list= static_cast<memcached_server_st*>(libmemcached_realloc(ptr, memcached_server_list(ptr),
- sizeof(memcached_server_st) * (ptr->number_of_hosts + 1)));
-
- if (new_host_list == NULL)
- return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
-
- memcached_server_list_set(ptr, new_host_list);
-
- /* TODO: Check return type */
- instance= memcached_server_instance_fetch(ptr, memcached_server_count(ptr));
-
- (void)memcached_server_create_with(ptr, instance, hostname, port, weight, type);