From: Brian Aker Date: Thu, 10 Jan 2008 00:39:38 +0000 (-0800) Subject: Fix for connect() to invalidate socket on failure. X-Git-Tag: 0.13~2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=51ccc3f82cc9bab7cf05e3b07b8a8b319349bde0;p=awesomized%2Flibmemcached Fix for connect() to invalidate socket on failure. --- diff --git a/ChangeLog b/ChangeLog index 81ab5c1d..ed7a8148 100644 --- 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 diff --git a/configure.ac b/configure.ac index 0cf13db9..01c1312b 100644 --- a/configure.ac +++ b/configure.ac @@ -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 # | | | # +------+ | +---+ # | | | diff --git a/lib/memcached_connect.c b/lib/memcached_connect.c index 42390a9a..278f9da3 100644 --- a/lib/memcached_connect.c +++ b/lib/memcached_connect.c @@ -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++;