Modified test to allow it to run on slow machines (aka it ran too long)
[m6w6/libmemcached] / lib / memcached_connect.c
index 34613ddd13a7a1007a8ec45b3bbdd2ed69170911..8ffaaef9fb91057e5c3f6ee1c8aba8c9368ccbdc 100644 (file)
@@ -14,7 +14,7 @@ memcached_return memcached_real_connect(memcached_st *ptr, unsigned int server_k
   if (ptr->hosts[server_key].fd == -1)
   {
     /* Old connection junk still is in the structure */
-    assert(ptr->hosts[server_key].stack_responses == 0);
+    WATCHPOINT_ASSERT(ptr->hosts[server_key].stack_responses == 0);
 
     if ((h= gethostbyname(ptr->hosts[server_key].hostname)) == NULL)
     {
@@ -86,7 +86,7 @@ test_connect:
       }
       ptr->connected++;
     }
-    assert(ptr->hosts[server_key].stack_responses == 0);
+    WATCHPOINT_ASSERT(ptr->hosts[server_key].stack_responses == 0);
   }
 
   return MEMCACHED_SUCCESS;
@@ -95,7 +95,7 @@ test_connect:
 
 memcached_return memcached_connect(memcached_st *ptr, unsigned int server_key)
 {
-  memcached_return rc;
+  memcached_return rc= MEMCACHED_NO_SERVERS;
   LIBMEMCACHED_MEMCACHED_CONNECT_START();
 
   if (ptr->connected == ptr->number_of_hosts)
@@ -112,7 +112,15 @@ memcached_return memcached_connect(memcached_st *ptr, unsigned int server_key)
     unsigned int x;
 
     for (x= 0; x < ptr->number_of_hosts; x++)
-      rc= memcached_real_connect(ptr, x);
+    {
+      memcached_return possible_rc;
+
+      possible_rc= memcached_real_connect(ptr, x);
+      rc= MEMCACHED_SUCCESS;
+
+      if (possible_rc != MEMCACHED_SUCCESS)
+        rc= MEMCACHED_SOME_ERRORS;
+    }
   }
   LIBMEMCACHED_MEMCACHED_CONNECT_END();