Merge in version util.
[m6w6/libmemcached] / libmemcached / connect.c
index 8d0e0a9b389982372588860cefa5cddbb26f2a39..a43de9563a89d2017b4658a3404abc8ad534bfd8 100644 (file)
@@ -316,7 +316,7 @@ static memcached_return_t network_connect(memcached_server_st *ptr)
           fds[0].events = POLLOUT;
 
           int timeout= ptr->root->connect_timeout;
-          if (ptr->root->flags.no_block == false)
+          if (ptr->root->flags.no_block == true)
             timeout= -1;
 
           size_t loop_max= 5;
@@ -330,6 +330,8 @@ static memcached_return_t network_connect(memcached_server_st *ptr)
               loop_max= 1;
               break;
             case 0:
+              if (loop_max==1) 
+                return MEMCACHED_TIMEOUT;
               continue;
               // A real error occurred and we need to completely bail
             default:
@@ -371,7 +373,7 @@ static memcached_return_t network_connect(memcached_server_st *ptr)
       }
 
 #ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
-      if (ptr->fd != -1 && ptr->root->sasl.callbacks != NULL)
+      if (ptr->fd != -1 && ptr->root->sasl && ptr->root->sasl->callbacks)
       {
         memcached_return rc= memcached_sasl_authenticate_connection(ptr);
         if (rc != MEMCACHED_SUCCESS)