From: Brian Aker Date: Sat, 7 Jul 2012 10:04:00 +0000 (-0700) Subject: Update cursor X-Git-Tag: 1.0.10~5^2~5 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=e2688497603c56929e6dd2b4e6139dd85edcb0e0;p=awesomized%2Flibmemcached Update cursor --- diff --git a/libmemcached-1.0/struct/server.h b/libmemcached-1.0/struct/server.h index fe984d1c..a8a30565 100644 --- a/libmemcached-1.0/struct/server.h +++ b/libmemcached-1.0/struct/server.h @@ -59,7 +59,8 @@ enum memcached_server_state_t { MEMCACHED_SERVER_STATE_ADDRINFO, // ADDRRESS information has been gathered MEMCACHED_SERVER_STATE_IN_PROGRESS, MEMCACHED_SERVER_STATE_CONNECTED, - MEMCACHED_SERVER_STATE_IN_TIMEOUT + MEMCACHED_SERVER_STATE_IN_TIMEOUT, + MEMCACHED_SERVER_STATE_DISABLED }; struct memcached_server_st { diff --git a/libmemcached/common.h b/libmemcached/common.h index ecaf5906..dad5bf21 100644 --- a/libmemcached/common.h +++ b/libmemcached/common.h @@ -165,13 +165,13 @@ extern "C" { memcached_return_t run_distribution(memcached_st *ptr); -#define memcached_server_response_increment(A) (A)->cursor_active++ -#define memcached_server_response_decrement(A) (A)->cursor_active-- -#define memcached_server_response_reset(A) (A)->cursor_active=0 +#define memcached_server_response_increment(A) (A)->cursor_active_++ +#define memcached_server_response_decrement(A) (A)->cursor_active_-- +#define memcached_server_response_reset(A) (A)->cursor_active_=0 -#define memcached_instance_response_increment(A) (A)->cursor_active++ -#define memcached_instance_response_decrement(A) (A)->cursor_active-- -#define memcached_instance_response_reset(A) (A)->cursor_active=0 +#define memcached_instance_response_increment(A) (A)->cursor_active_++ +#define memcached_instance_response_decrement(A) (A)->cursor_active_-- +#define memcached_instance_response_reset(A) (A)->cursor_active_=0 #ifdef __cplusplus } diff --git a/libmemcached/connect.cc b/libmemcached/connect.cc index 647ea03b..03295df2 100644 --- a/libmemcached/connect.cc +++ b/libmemcached/connect.cc @@ -405,7 +405,7 @@ static memcached_return_t network_connect(org::libmemcached::Instance* server) bool timeout_error_occured= false; WATCHPOINT_ASSERT(server->fd == INVALID_SOCKET); - WATCHPOINT_ASSERT(server->cursor_active == 0); + WATCHPOINT_ASSERT(server->cursor_active_ == 0); /* We want to check both of these because if address_info_next has been fully tried, we want to do a new lookup to make sure we have picked up on any new DNS information. diff --git a/libmemcached/get.cc b/libmemcached/get.cc index 73802e20..b774e7d5 100644 --- a/libmemcached/get.cc +++ b/libmemcached/get.cc @@ -320,9 +320,9 @@ static memcached_return_t memcached_mget_by_key_real(memcached_st *ptr, failures_occured_in_sending= true; continue; } - WATCHPOINT_ASSERT(instance->cursor_active == 0); + WATCHPOINT_ASSERT(instance->cursor_active_ == 0); memcached_instance_response_increment(instance); - WATCHPOINT_ASSERT(instance->cursor_active == 1); + WATCHPOINT_ASSERT(instance->cursor_active_ == 1); } else { diff --git a/libmemcached/instance.cc b/libmemcached/instance.cc index e7bb3794..01c514f1 100644 --- a/libmemcached/instance.cc +++ b/libmemcached/instance.cc @@ -45,7 +45,7 @@ static inline void _server_init(org::libmemcached::Instance* self, memcached_st self->options.is_shutting_down= false; self->options.is_dead= false; self->number_of_hosts= 0; - self->cursor_active= 0; + self->cursor_active_= 0; self->port_= port; self->fd= INVALID_SOCKET; self->io_bytes_sent= 0; @@ -386,5 +386,5 @@ uint32_t memcached_instance_response_count(const org::libmemcached::Instance* se return 0; } - return self->cursor_active; + return self->cursor_active_; } diff --git a/libmemcached/instance.h b/libmemcached/instance.h index 1c81da44..c7539d80 100644 --- a/libmemcached/instance.h +++ b/libmemcached/instance.h @@ -70,12 +70,25 @@ struct Instance { port_= arg; } - inline void mark_server_as_clean() + void mark_server_as_clean() { server_failure_counter= 0; next_retry= 0; } + void disable() + { + } + + void enable() + { + } + + uint32_t response_count() const + { + return cursor_active_; + } + struct { bool is_allocated:1; bool is_initialized:1; @@ -83,7 +96,7 @@ struct Instance { bool is_dead:1; } options; uint32_t number_of_hosts; - uint32_t cursor_active; + uint32_t cursor_active_; in_port_t port_; memcached_socket_t fd; uint32_t io_bytes_sent; /* # bytes sent since last read */ diff --git a/libmemcached/quit.cc b/libmemcached/quit.cc index cc75bd42..77924fb4 100644 --- a/libmemcached/quit.cc +++ b/libmemcached/quit.cc @@ -116,7 +116,7 @@ void memcached_quit_server(org::libmemcached::Instance* ptr, bool io_death) } ptr->state= MEMCACHED_SERVER_STATE_NEW; - ptr->cursor_active= 0; + ptr->cursor_active_= 0; ptr->io_bytes_sent= 0; ptr->write_buffer_offset= size_t(ptr->root and memcached_is_udp(ptr->root) ? UDP_DATAGRAM_HEADER_LENGTH : 0); ptr->read_buffer_length= 0; diff --git a/libmemcached/server.cc b/libmemcached/server.cc index 6dca4ab6..f68e1f6b 100644 --- a/libmemcached/server.cc +++ b/libmemcached/server.cc @@ -219,7 +219,7 @@ uint32_t memcached_server_response_count(const memcached_server_instance_st self return 0; } - return self->cursor_active; + return self->cursor_active_; } const char *memcached_server_type(const memcached_server_instance_st ptr) diff --git a/libmemcached/stats.cc b/libmemcached/stats.cc index 662edafb..ab00d4b8 100644 --- a/libmemcached/stats.cc +++ b/libmemcached/stats.cc @@ -428,7 +428,7 @@ static memcached_return_t binary_stats_fetch(memcached_stat_st *memc_stat, * memcached_response will decrement the counter, so I need to reset it.. * todo: look at this and try to find a better solution. * */ - instance->cursor_active= 0; + instance->cursor_active_= 0; return MEMCACHED_SUCCESS; }