- memcached_return_t rc;
- if (ptr->root->flags.binary_protocol)
- {
- protocol_binary_request_quit request= {}; // = {.bytes= {0}};
- request.message.header.request.magic = PROTOCOL_BINARY_REQ;
- request.message.header.request.opcode = PROTOCOL_BINARY_CMD_QUIT;
- request.message.header.request.datatype = PROTOCOL_BINARY_RAW_BYTES;
-
- struct libmemcached_io_vector_st vector[]=
- {
- { request.bytes, sizeof(request.bytes) }
- };
-
- rc= memcached_vdo(ptr, vector, 1, true);
- }
- else
- {
- struct 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
- * not read
- *
- * 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)
- {
- memcached_return_t rc_slurp;
- while (memcached_continue(rc_slurp= memcached_io_slurp(ptr))) {} ;
- WATCHPOINT_ASSERT(rc_slurp == MEMCACHED_CONNECTION_FAILURE);
- }
-
- /*
- * memcached_io_read may call memcached_quit_server with io_death if
- * it encounters problems, but we don't care about those occurences.
- * The intention of that loop is to drain the data sent from the
- * server to ensure that the server processed all of the data we
- * sent to the server.
- */
- ptr->server_failure_counter= 0;