Fix for bad disconnect during test run.
authorBrian Aker <brian@tangent.org>
Fri, 28 Nov 2008 17:57:42 +0000 (09:57 -0800)
committerBrian Aker <brian@tangent.org>
Fri, 28 Nov 2008 17:57:42 +0000 (09:57 -0800)
libmemcached/memcached_connect.c
tests/function.c

index 429e8ec66f581488efbefa920181e31efcea05bb..12f4affd9ed6f31469689a23c8f55780a193ed82 100644 (file)
@@ -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;
             }
 
index 3ef5151ff6be76168d34e3a184e1c7361ea2abaa..f06c278606f88e84bacdc8938189852c24b2293f 100644 (file)
@@ -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);
   }