Comment 8 for bug 928696

Revision history for this message
Nicolas Motte (nicolas-motte) wrote :

This bug is still not fixed in libmemcached 1.0.16

When memcached_quit_server is called, libmemcached calls close_socket which will set the state to NEW. Then mark_server_for_timeout will reset the next_retry.

As a quick fix, I copied the code of mark_server_for_timeout in memcached_quit_server without the part that reset the next_retry.

My tests are fine now, but maybe I broke something.

-------------------------------------------
void memcached_quit_server(org::libmemcached::Instance* instance, bool io_death)
{
  if (instance->valid())
  {
    if (io_death == false and memcached_is_udp(instance->root) == false and instance->is_shutting_down() == false)
    {
      send_quit_message(instance);

      instance->start_close_socket();
      drain_instance(instance);
    }
  }

  instance->close_socket();

  if (io_death)
  {
      instance->state= MEMCACHED_SERVER_STATE_IN_TIMEOUT;
      if (instance->server_failure_counter_query_id != instance->root->query_id)
      {
        instance->server_failure_counter++;
        instance->server_failure_counter_query_id= instance->root->query_id;
      }
      set_last_disconnected_host(instance);
  }
}
----------------------------------------