Merge Thomason's cork patch.
[awesomized/libmemcached] / libmemcached / connect.c
index 96f26fb80e07f6116435eb4ef9259f4d9db14134..6d08eb709065f35b02303e209ac666316a8e7950 100644 (file)
@@ -111,7 +111,7 @@ static memcached_return_t set_socket_options(memcached_server_st *ptr)
       return MEMCACHED_FAILURE;
   }
 
-  if (ptr->root->send_size)
+  if (ptr->root->send_size > 0)
   {
     int error;
 
@@ -122,7 +122,7 @@ static memcached_return_t set_socket_options(memcached_server_st *ptr)
       return MEMCACHED_FAILURE;
   }
 
-  if (ptr->root->recv_size)
+  if (ptr->root->recv_size > 0)
   {
     int error;
 
@@ -208,7 +208,9 @@ static memcached_return_t network_connect(memcached_server_st *ptr)
   {
     struct addrinfo *use;
 
-    if (!ptr->sockaddr_inited ||
+    WATCHPOINT_ASSERT(ptr->cursor_active == 0);
+
+    if (! ptr->options.sockaddr_inited ||
         (!(ptr->root->flags.use_cache_lookups)))
     {
       memcached_return_t rc;
@@ -216,7 +218,7 @@ static memcached_return_t network_connect(memcached_server_st *ptr)
       rc= set_hostinfo(ptr);
       if (rc != MEMCACHED_SUCCESS)
         return rc;
-      ptr->sockaddr_inited= true;
+      ptr->options.sockaddr_inited= true;
     }
 
     use= ptr->address_info;
@@ -282,7 +284,6 @@ static memcached_return_t network_connect(memcached_server_st *ptr)
 
       if (ptr->fd != -1)
       {
-        WATCHPOINT_ASSERT(ptr->cursor_active == 0);
         ptr->server_failure_counter= 0;
         return MEMCACHED_SUCCESS;
       }