- // We should optimize this to remove the allocation if the server was
- // the last server to die
- if (ptr->next_retry > curr_time.tv_sec)
- {
- set_last_disconnected_host(ptr);
+ memcached_return_t rc;
+ if (memcached_failed(rc= run_distribution((memcached_st *)server->root)))
+ {
+ return memcached_set_error(*server, rc, MEMCACHED_AT, memcached_literal_param("Backoff handling failed during run_distribution"));
+ }
+
+ return memcached_set_error(*server, MEMCACHED_SERVER_MARKED_DEAD, MEMCACHED_AT);
+ }
+
+ server->state= MEMCACHED_SERVER_STATE_IN_TIMEOUT;