X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fserver_list.c;h=ca37f7f9a4b3f159e5f8747d50be33c4918a3698;hb=259ed7e68a0de0887e9aedbe0aa5fdd9404929f9;hp=64b8b0c4c83ed101c0cdac2198f8863dccb882a1;hpb=b5c61c39efbf6054d45507283ba74007d0e1ea61;p=m6w6%2Flibmemcached diff --git a/libmemcached/server_list.c b/libmemcached/server_list.c index 64b8b0c4..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 */ @@ -43,7 +45,7 @@ memcached_server_list_append_with_weight(memcached_server_list_st ptr, } /* @todo Check return type */ - memcached_server_create_with(NULL, &new_host_list[count-1], hostname, port, weight, MEMCACHED_CONNECTION_TCP); + 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;