From: Brian Aker Date: Sat, 10 Sep 2011 05:16:02 +0000 (-0700) Subject: Solution for cases where next has been set to NULL. X-Git-Tag: 0.52~2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=dcddc0964b560a3494ee079822a94074ea94b832;p=m6w6%2Flibmemcached Solution for cases where next has been set to NULL. --- diff --git a/libmemcached/connect.cc b/libmemcached/connect.cc index 589c40c5..1c4ea913 100644 --- a/libmemcached/connect.cc +++ b/libmemcached/connect.cc @@ -400,9 +400,13 @@ static memcached_return_t network_connect(memcached_server_st *server) WATCHPOINT_ASSERT(server->fd == INVALID_SOCKET); WATCHPOINT_ASSERT(server->cursor_active == 0); + /* + We want to check both of these because if address_info_next has been fully tried, we want to do a new lookup to make sure we have picked up on any new DNS information. + */ if (server->address_info == NULL or server->address_info_next == NULL) { WATCHPOINT_ASSERT(server->state == MEMCACHED_SERVER_STATE_NEW); + server->address_info_next= NULL; memcached_return_t rc; uint32_t counter= 5; while (--counter) @@ -428,6 +432,12 @@ static memcached_return_t network_connect(memcached_server_st *server) } } + if (server->address_info_next == NULL) + { + server->address_info_next= server->address_info; + server->state= MEMCACHED_SERVER_STATE_ADDRINFO; + } + /* Create the socket */ while (server->address_info_next and server->fd == INVALID_SOCKET) {