From: Yingxin Cheng Date: Wed, 7 Aug 2019 15:28:30 +0000 (+0800) Subject: crimson/net: reset write state with reset_write() X-Git-Tag: v15.1.0~1910^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=492263962c0c9da2c592e5e6cf62d50ddbfaefb3;p=ceph.git crimson/net: reset write state with reset_write() Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/net/Protocol.cc b/src/crimson/net/Protocol.cc index 81d799264100..4af213471c6b 100644 --- a/src/crimson/net/Protocol.cc +++ b/src/crimson/net/Protocol.cc @@ -96,6 +96,16 @@ void Protocol::notify_keepalive_ack(utime_t _keepalive_ack) write_event(); } +void Protocol::reset_write() +{ + assert(write_state != write_state_t::open); + conn.out_seq = 0; + conn.out_q.clear(); + conn.sent.clear(); + need_keepalive = false; + keepalive_ack = std::nullopt; +} + seastar::future Protocol::do_write_dispatch_sweep() { switch (write_state) { diff --git a/src/crimson/net/Protocol.h b/src/crimson/net/Protocol.h index 66794ab66a5d..a41d1f20156b 100644 --- a/src/crimson/net/Protocol.h +++ b/src/crimson/net/Protocol.h @@ -102,6 +102,8 @@ class Protocol { void notify_keepalive_ack(utime_t keepalive_ack); + void reset_write(); + bool is_queued() const { return (!conn.out_q.empty() || need_keepalive || diff --git a/src/crimson/net/ProtocolV2.cc b/src/crimson/net/ProtocolV2.cc index 0c1ded6b1cce..4b3506f3ba24 100644 --- a/src/crimson/net/ProtocolV2.cc +++ b/src/crimson/net/ProtocolV2.cc @@ -416,11 +416,7 @@ void ProtocolV2::reset_session(bool full) if (full) { client_cookie = generate_client_cookie(); peer_global_seq = 0; - conn.out_seq = 0; - // TODO: - // discard_out_queue(); - // message_seq = 0; - // ack_left = 0; + reset_write(); seastar::with_gate(pending_dispatch, [this] { return dispatcher.ms_handle_remote_reset( seastar::static_pointer_cast(conn.shared_from_this()))