Skip IPv6 addresses in UDP mode (the server doesn't listen on them)
authorEric Lambert <eric.lambert@sun.com>
Mon, 9 Mar 2009 22:01:08 +0000 (23:01 +0100)
committerEric Lambert <eric.lambert@sun.com>
Mon, 9 Mar 2009 22:01:08 +0000 (23:01 +0100)
libmemcached/memcached_connect.c

index c2e03ac38e7a4279512f84c0c096e63545769f1c..f066c52661d25a585585d60fa5496aad08cc2cf9 100644 (file)
@@ -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)