From: Brian Aker Date: Thu, 24 Mar 2011 23:06:37 +0000 (-0700) Subject: Add option to use UDS with server list. X-Git-Tag: 0.51~20^2~3 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=dcc0ab6e56c650946d32c57cd1479cdb8534221f;p=awesomized%2Flibmemcached Add option to use UDS with server list. --- 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;