X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fquit.cc;h=4bf72f64adf94b985e4a2eb9506414de171122a5;hb=7d698ad128550cb4d2e3a60c83533c4370efd106;hp=9aadd605f71ea802009686c1b20bb897507b2203;hpb=9169cee9ec0f231b3117a0d5a7840d2067f29610;p=m6w6%2Flibmemcached diff --git a/libmemcached/quit.cc b/libmemcached/quit.cc index 9aadd605..4bf72f64 100644 --- a/libmemcached/quit.cc +++ b/libmemcached/quit.cc @@ -46,7 +46,7 @@ will force data to be completed. */ -void memcached_quit_server(memcached_server_st *ptr, bool io_death) +void memcached_quit_server(memcached_instance_st *ptr, bool io_death) { if (ptr->fd != INVALID_SOCKET) { @@ -58,7 +58,9 @@ void memcached_quit_server(memcached_server_st *ptr, bool io_death) 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; @@ -79,8 +81,6 @@ void memcached_quit_server(memcached_server_st *ptr, bool io_death) 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 @@ -89,11 +89,18 @@ void memcached_quit_server(memcached_server_st *ptr, bool io_death) * 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); + } } /*