X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fserver_list.c;h=ca37f7f9a4b3f159e5f8747d50be33c4918a3698;hb=b048aacba5d279f3271163cfaa0704684beca1e2;hp=c20f8dbf9b775679131a5db0c4473d44d5682462;hpb=4209d822c35fea2ca1c5879e18bc6c063dba4c41;p=awesomized%2Flibmemcached diff --git a/libmemcached/server_list.c b/libmemcached/server_list.c index c20f8dbf..ca37f7f9 100644 --- a/libmemcached/server_list.c +++ b/libmemcached/server_list.c @@ -24,7 +24,9 @@ memcached_server_list_append_with_weight(memcached_server_list_st ptr, 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 */ @@ -42,8 +44,11 @@ memcached_server_list_append_with_weight(memcached_server_list_st ptr, 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);