Fix for connect() to invalidate socket on failure.
authorBrian Aker <brian@tangent.org>
Thu, 10 Jan 2008 00:39:38 +0000 (16:39 -0800)
committerBrian Aker <brian@tangent.org>
Thu, 10 Jan 2008 00:39:38 +0000 (16:39 -0800)
ChangeLog
configure.ac
lib/memcached_connect.c

index 81ab5c1de5e4d40fd208011d0573e79a9dde1979..ed7a8148beb6e42f946bd778e4093dc038ef0db9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 0.13
+  * Fix for failure to connect to invalidate socket.
   * Patch from Marc Rossi to add --hash option for memcp, memrm, and memcat.
   * Kevin's patch for fixing EOF issues during a read.
   * Toru Maesaka patch for stats mismatch
index 0cf13db9b10c43fe71a84cd993e803eb910f5bd2..01c1312b589c69a8c8cc94bc16746e42e1793fa6 100644 (file)
@@ -15,7 +15,7 @@ MEMCACHED_API_VERSION=1.0
 AC_SUBST(MEMCACHED_API_VERSION)
 
 #shared library versioning
-MEMCACHED_LIBRARY_VERSION=2:2:1
+MEMCACHED_LIBRARY_VERSION=2:0:0
 #                         | | |
 #                  +------+ | +---+
 #                  |        |     |
index 42390a9af30cd92319c2a8695b9b24c1de5c0c21..278f9da3292710d91a553491b235c9e3606d8ece 100644 (file)
@@ -10,7 +10,6 @@ static memcached_return set_hostinfo(memcached_server_st *server)
   sprintf(str_port, "%u", server->port);
 
   memset(&hints, 0, sizeof(hints));
-  hints.ai_family= AF_INET;
   hints.ai_socktype= SOCK_STREAM;
   hints.ai_protocol= 0;
 
@@ -219,6 +218,8 @@ test_connect:
       default:
         ptr->cached_errno= errno;
         WATCHPOINT_ERRNO(ptr->cached_errno);
+        close(ptr->hosts[server_key].fd);
+        ptr->hosts[server_key].fd= -1;
         return MEMCACHED_ERRNO;
       }
       ptr->connected++;