From: Eric Lambert Date: Mon, 9 Mar 2009 22:01:08 +0000 (+0100) Subject: Skip IPv6 addresses in UDP mode (the server doesn't listen on them) X-Git-Tag: 0.27~22 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=1981c415d9d5fb935d7f06f2aa1f9c5e30385f48;p=m6w6%2Flibmemcached Skip IPv6 addresses in UDP mode (the server doesn't listen on them) --- diff --git a/libmemcached/memcached_connect.c b/libmemcached/memcached_connect.c index c2e03ac3..f066c526 100644 --- a/libmemcached/memcached_connect.c +++ b/libmemcached/memcached_connect.c @@ -208,6 +208,12 @@ static memcached_return network_connect(memcached_server_st *ptr) /* Create the socket */ while (use != NULL) { + /* Memcache server does not support IPV6 in udp mode, so skip if not ipv4 */ + if (ptr->type == MEMCACHED_CONNECTION_UDP && use->ai_family != AF_INET) { + use= use->ai_next; + continue; + } + if ((ptr->fd= socket(use->ai_family, use->ai_socktype, use->ai_protocol)) < 0)