X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fconnect.c;h=4b8939c11d4942802ea511134df2ad962acb3672;hb=d70dd7ca2db0a4f7d7c63367466567cc1efe9f68;hp=e58e37fc1bcc7746dadcff00828d5d50ea92d3db;hpb=015acfbd94575175d5af15c583e10cb5f67b202d;p=m6w6%2Flibmemcached diff --git a/libmemcached/connect.c b/libmemcached/connect.c index e58e37fc..4b8939c1 100644 --- a/libmemcached/connect.c +++ b/libmemcached/connect.c @@ -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; @@ -210,7 +210,7 @@ static memcached_return_t network_connect(memcached_server_st *ptr) WATCHPOINT_ASSERT(ptr->cursor_active == 0); - if (!ptr->sockaddr_inited || + if (! ptr->options.sockaddr_inited || (!(ptr->root->flags.use_cache_lookups))) { memcached_return_t rc; @@ -218,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; @@ -313,7 +313,7 @@ static memcached_return_t network_connect(memcached_server_st *ptr) } -memcached_return_t memcached_connect(memcached_server_st *ptr) +memcached_return_t memcached_connect(memcached_server_write_instance_st ptr) { memcached_return_t rc= MEMCACHED_NO_SERVERS; LIBMEMCACHED_MEMCACHED_CONNECT_START(); @@ -335,12 +335,16 @@ memcached_return_t memcached_connect(memcached_server_st *ptr) if (curr_time.tv_sec < ptr->next_retry) { - if (memcached_behavior_get(ptr->root, MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS)) + memcached_st *root= (memcached_st *)ptr->root; + // @todo fix this by fixing behavior to no longer make use of + // memcached_st + if (memcached_behavior_get(root, MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS)) { - run_distribution(ptr->root); + run_distribution(root); } - ptr->root->last_disconnected_server = ptr; + root->last_disconnected_server = ptr; + return MEMCACHED_SERVER_MARKED_DEAD; } } @@ -364,7 +368,12 @@ memcached_return_t memcached_connect(memcached_server_st *ptr) WATCHPOINT_ASSERT(0); } - unlikely ( rc != MEMCACHED_SUCCESS) ptr->root->last_disconnected_server = ptr; + unlikely ( rc != MEMCACHED_SUCCESS) + { + //@todo create interface around last_discontected_server + memcached_st *root= (memcached_st *)ptr->root; + root->last_disconnected_server = ptr; + } LIBMEMCACHED_MEMCACHED_CONNECT_END();