if (hostname == NULL || error == NULL)
return NULL;
- if (! port)
+ if (hostname[0] == '/')
+ port = 0;
+ else if (! port)
port= MEMCACHED_DEFAULT_PORT;
/* Increment count for hosts */
new_host_list= (memcached_server_write_instance_st)realloc(ptr, sizeof(memcached_server_st) * count);
if (!new_host_list)
{
+ ptr->cached_errno= errno;
*error= MEMCACHED_MEMORY_ALLOCATION_FAILURE;
return NULL;
}
- /* TODO: Check return type */
- memcached_server_create_with(NULL, &new_host_list[count-1], hostname, port, weight, MEMCACHED_CONNECTION_TCP);
+ /* @todo Check return type */
+ memcached_server_create_with(NULL, &new_host_list[count-1], hostname, port, weight, port ? MEMCACHED_CONNECTION_TCP : MEMCACHED_CONNECTION_UNIX_SOCKET);
+
+ // Handset allocated since
+ new_host_list->options.is_allocated= true;
/* Backwards compatibility hack */
memcached_servers_set_count(new_host_list, count);