From: Brian Aker Date: Fri, 28 Nov 2008 17:57:42 +0000 (-0800) Subject: Fix for bad disconnect during test run. X-Git-Tag: 0.25~1 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=99ba76f7596ab5b861e68034ae3007cccf73a5d2;p=awesomized%2Flibmemcached Fix for bad disconnect during test run. --- diff --git a/libmemcached/memcached_connect.c b/libmemcached/memcached_connect.c index 429e8ec6..12f4affd 100644 --- a/libmemcached/memcached_connect.c +++ b/libmemcached/memcached_connect.c @@ -238,18 +238,12 @@ test_connect: { goto handle_retry; } - else if (error != 1 || fds[0].revents & POLLERR) + else if (error != 1 && fds[0].revents & POLLERR) { ptr->cached_errno= errno; WATCHPOINT_ERRNO(ptr->cached_errno); WATCHPOINT_NUMBER(ptr->root->connect_timeout); - close(ptr->fd); - ptr->fd= -1; - if (ptr->address_info) - { - freeaddrinfo(ptr->address_info); - ptr->address_info= NULL; - } + memcached_quit_server(ptr, 1); if (ptr->root->retry_timeout) { @@ -259,6 +253,7 @@ test_connect: ptr->next_retry= next_time.tv_sec + ptr->root->retry_timeout; } ptr->server_failure_counter+= 1; + return MEMCACHED_ERRNO; } diff --git a/tests/function.c b/tests/function.c index 3ef5151f..f06c2786 100644 --- a/tests/function.c +++ b/tests/function.c @@ -1397,10 +1397,13 @@ static test_return user_supplied_bug1(memcached_st *memc) sprintf(key, "%d", x); rc = memcached_set(memc, key, strlen(key), randomstuff, strlen(randomstuff), 10, 0); + WATCHPOINT_ERROR(rc); + assert(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); /* If we fail, lets try again */ if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_BUFFERED) rc = memcached_set(memc, key, strlen(key), randomstuff, strlen(randomstuff), 10, 0); + WATCHPOINT_ERROR(rc); assert(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); }