return MEMCACHED_SUCCESS;
case 0:
return MEMCACHED_TIMEOUT;
-#if TARGET_OS_LINUX
+#ifdef TARGET_OS_LINUX
case ERESTART:
#endif
case EINTR:
continue;
default:
ptr->cached_errno= error;
- memcached_quit_server(ptr, 1);
+ memcached_quit_server(ptr, true);
return MEMCACHED_FAILURE;
}
/* Imposssible for anything other then -1 */
WATCHPOINT_ASSERT(error == -1);
ptr->cached_errno= error;
- memcached_quit_server(ptr, 1);
+ memcached_quit_server(ptr, true);
return MEMCACHED_FAILURE;
}
{
case EAGAIN:
case EINTR:
-#if TARGET_OS_LINUX
+#ifdef TARGET_OS_LINUX
case ERESTART:
#endif
if ((rc= io_wait(ptr, MEM_READ)) == MEMCACHED_SUCCESS)
default:
{
- memcached_quit_server(ptr, 1);
+ memcached_quit_server(ptr, true);
*nread= -1;
return rc;
}
for blocking I/O we do not return 0 and for non-blocking case
it will return EGAIN if data is not immediatly available.
*/
- memcached_quit_server(ptr, 1);
+ memcached_quit_server(ptr, true);
*nread= -1;
return MEMCACHED_UNKNOWN_READ_FAILURE;
}
if (rc == MEMCACHED_SUCCESS || rc == MEMCACHED_TIMEOUT)
continue;
- memcached_quit_server(ptr, 1);
+ memcached_quit_server(ptr, true);
return -1;
}
default:
- memcached_quit_server(ptr, 1);
+ memcached_quit_server(ptr, true);
*error= MEMCACHED_ERRNO;
return -1;
}
if (ptr->type == MEMCACHED_CONNECTION_UDP &&
(size_t)sent_length != write_length)
{
- memcached_quit_server(ptr, 1);
+ memcached_quit_server(ptr, true);
return -1;
}
*/
void memcached_io_reset(memcached_server_instance_st *ptr)
{
- memcached_quit_server(ptr, 1);
+ memcached_quit_server(ptr, true);
}
/**
{
if (ptr->fd != -1)
{
- if (io_death == false && ptr->type != MEMCACHED_CONNECTION_UDP)
+ if (io_death == false && ptr->type != MEMCACHED_CONNECTION_UDP && ptr->options.is_shutting_down == false)
{
memcached_return_t rc;
char buffer[MEMCACHED_MAX_BUFFER];
+ ptr->options.is_shutting_down= true;
+
if (ptr->root->flags.binary_protocol)
{
protocol_binary_request_quit request = {.bytes= {0}};
ptr->write_buffer_offset= (size_t) ((ptr->type == MEMCACHED_CONNECTION_UDP) ? UDP_DATAGRAM_HEADER_LENGTH : 0);
ptr->read_buffer_length= 0;
ptr->read_ptr= ptr->read_buffer;
+ ptr->options.is_shutting_down= false;
memcached_server_response_reset(ptr);
if (io_death)
memcached_server_instance_st *instance=
memcached_server_instance_fetch(ptr, x);
- memcached_quit_server(instance, 0);
+ memcached_quit_server(instance, false);
}
}
}
uint32_t weight, memcached_connection_t type)
{
self->options.sockaddr_inited= false;
+ self->options.is_shutting_down= false;
self->number_of_hosts= 0;
self->cursor_active= 0;
self->port= port;
void memcached_server_free(memcached_server_st *self)
{
- memcached_quit_server(self, 0);
+ memcached_quit_server(self, false);
if (self->cached_server_error)
free(self->cached_server_error);