]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: reset write state with reset_write()
authorYingxin Cheng <yingxin.cheng@intel.com>
Wed, 7 Aug 2019 15:28:30 +0000 (23:28 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Mon, 12 Aug 2019 09:02:52 +0000 (17:02 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/net/Protocol.cc
src/crimson/net/Protocol.h
src/crimson/net/ProtocolV2.cc

index 81d7992641002dd482b2031a4adee60de1f57d48..4af213471c6b811182f86e57b9c9a397d2e4a903 100644 (file)
@@ -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<stop_t> Protocol::do_write_dispatch_sweep()
 {
   switch (write_state) {
index 66794ab66a5d71c8475f390902f16894cbe71b82..a41d1f20156b5203e7652fa0e75378292168e345 100644 (file)
@@ -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 ||
index 0c1ded6b1ccee2c7df209d65ecfa4c73a89cd65b..4b3506f3ba248dc93d07584c956084e5c68f0849 100644 (file)
@@ -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<SocketConnection>(conn.shared_from_this()))