X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fquit.cc;h=929d0ca0cc3809f48884e637e3cecf1ae96ed55a;hb=b5495838fb245aa1068a1198ed549b98a9c3e666;hp=ffd4cd459cd767e71537e4e0971546f7fe53d70e;hpb=4516b19d6171edf4830d4502818a52187db0d37e;p=m6w6%2Flibmemcached diff --git a/libmemcached/quit.cc b/libmemcached/quit.cc index ffd4cd45..929d0ca0 100644 --- a/libmemcached/quit.cc +++ b/libmemcached/quit.cc @@ -58,17 +58,28 @@ 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; - rc= memcached_do(ptr, request.bytes, sizeof(request.bytes), true); + + libmemcached_io_vector_st vector[]= + { + { request.bytes, sizeof(request.bytes) } + }; + + rc= memcached_vdo(ptr, vector, 1, true); } else { - rc= memcached_do(ptr, memcached_literal_param("quit\r\n"), true); - } + libmemcached_io_vector_st vector[]= + { + { memcached_literal_param("quit\r\n") } + }; - WATCHPOINT_ASSERT(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_FETCH_NOTFINISHED); + rc= memcached_vdo(ptr, vector, 1, true); + } /* read until socket is closed, or there is an error * closing the socket before all data is read @@ -78,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); + } } /* @@ -129,7 +147,8 @@ void send_quit(memcached_st *ptr) void memcached_quit(memcached_st *ptr) { - if (memcached_failed(initialize_query(ptr))) + memcached_return_t rc; + if (memcached_failed(rc= initialize_query(ptr, true))) { return; }