will force data to be completed.
*/
-void memcached_quit_server(memcached_server_st *ptr, bool io_death)
+void memcached_quit_server(org::libmemcached::Instance* ptr, bool io_death)
{
if (ptr->fd != INVALID_SOCKET)
{
if (ptr->root->flags.binary_protocol)
{
protocol_binary_request_quit request= {}; // = {.bytes= {0}};
- request.message.header.request.magic = PROTOCOL_BINARY_REQ;
+
+ initialize_binary_request(ptr, request.message.header);
+
request.message.header.request.opcode = PROTOCOL_BINARY_CMD_QUIT;
request.message.header.request.datatype = PROTOCOL_BINARY_RAW_BYTES;
- struct libmemcached_io_vector_st vector[]=
+ libmemcached_io_vector_st vector[]=
{
{ request.bytes, sizeof(request.bytes) }
};
}
else
{
- struct libmemcached_io_vector_st vector[]=
+ libmemcached_io_vector_st vector[]=
{
{ memcached_literal_param("quit\r\n") }
};
rc= memcached_vdo(ptr, vector, 1, true);
}
- WATCHPOINT_ASSERT(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_FETCH_NOTFINISHED);
-
/* read until socket is closed, or there is an error
* closing the socket before all data is read
* results in server throwing away all data which is
* In .40 we began to only do this if we had been doing buffered
* requests of had replication enabled.
*/
- if (ptr->root->flags.buffer_requests or ptr->root->number_of_replicas)
+ if (memcached_success(rc) and (ptr->root->flags.buffer_requests or ptr->root->number_of_replicas))
{
- memcached_return_t rc_slurp;
- while (memcached_continue(rc_slurp= memcached_io_slurp(ptr))) {} ;
- WATCHPOINT_ASSERT(rc_slurp == MEMCACHED_CONNECTION_FAILURE);
+ if (0)
+ {
+ memcached_return_t rc_slurp;
+ while (memcached_continue(rc_slurp= memcached_io_slurp(ptr))) {} ;
+ WATCHPOINT_ASSERT(rc_slurp == MEMCACHED_CONNECTION_FAILURE);
+ }
+ else
+ {
+ memcached_io_slurp(ptr);
+ }
}
/*
}
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;
{
for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
- memcached_server_write_instance_st instance=
- memcached_server_instance_fetch(ptr, x);
+ org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x);
memcached_quit_server(instance, false);
}