From fe7054da228e9acd5bd2cc19c253517390a0093f Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Fri, 25 Nov 2022 09:31:20 +0800 Subject: [PATCH] crimson/net: move remote reset after waiting And only dispatch the remote reset when the connection is still valid. Signed-off-by: Yingxin Cheng --- src/crimson/net/ProtocolV2.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/crimson/net/ProtocolV2.cc b/src/crimson/net/ProtocolV2.cc index 4f6e113bc8096..b4097c3f84468 100644 --- a/src/crimson/net/ProtocolV2.cc +++ b/src/crimson/net/ProtocolV2.cc @@ -1589,20 +1589,23 @@ void ProtocolV2::trigger_replacing(bool reconnect, new_conn_features, new_peer_supported_features, new_peer_global_seq, new_connect_seq, new_msg_seq] () mutable { - return wait_out_exit_dispatching().then([this, do_reset] { - if (do_reset) { - reset_session(true); - } + return wait_out_exit_dispatching( + ).then([this] { protocol_timer.cancel(); return execution_done.get_future(); }).then([this, reconnect, + do_reset, mover = std::move(mover), new_auth_meta = std::move(new_auth_meta), new_client_cookie, new_peer_name, new_conn_features, new_peer_supported_features, new_peer_global_seq, new_connect_seq, new_msg_seq] () mutable { + if (state == state_t::REPLACING && do_reset) { + reset_session(true); + } + if (unlikely(state != state_t::REPLACING)) { return mover.socket->close( ).then([sock = std::move(mover.socket)] { -- 2.39.5