WATCHPOINT_ASSERT(ptr->root);
if (ptr->root->retry_timeout && ptr->root->server_failure_limit)
{
- struct timeval next_time;
+ struct timeval curr_time;
- gettimeofday(&next_time, NULL);
+ gettimeofday(&curr_time, NULL);
/* if we've had too many consecutive errors on this server, mark it dead. */
- if (ptr->server_failure_counter > ptr->root->server_failure_limit)
+ if (ptr->server_failure_counter >= ptr->root->server_failure_limit)
{
- ptr->next_retry= next_time.tv_sec + ptr->root->retry_timeout;
+ ptr->next_retry= curr_time.tv_sec + ptr->root->retry_timeout;
ptr->server_failure_counter= 0;
}
- if (next_time.tv_sec < ptr->next_retry)
+ if (curr_time.tv_sec < ptr->next_retry)
{
if (memcached_behavior_get(ptr->root, MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS))
run_distribution(ptr->root);
+ ptr->root->last_disconnected_server = ptr;
return MEMCACHED_SERVER_MARKED_DEAD;
}
}