]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: split gate for handshake and IO
authorYingxin Cheng <yingxin.cheng@intel.com>
Wed, 16 Nov 2022 05:16:07 +0000 (13:16 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Wed, 8 Feb 2023 06:07:41 +0000 (14:07 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/net/Protocol.h
src/crimson/net/ProtocolV2.cc
src/crimson/net/ProtocolV2.h

index 5260f05bae73aef89a91117723676bf433268a4a..260634a2828468f32c5d0a58409940f75d14e65b 100644 (file)
@@ -90,6 +90,11 @@ class Protocol {
 
 // TODO: encapsulate a SessionedSender class
  protected:
+  seastar::future<> close_out() {
+    assert(!gate.is_closed());
+    return gate.close();
+  }
+
   /**
    * out_state_t
    *
@@ -165,8 +170,6 @@ class Protocol {
     return ++out_seq;
   }
 
-  crimson::common::Gated gate;
-
   ChainedDispatchers& dispatchers;
 
   SocketConnection &conn;
@@ -184,6 +187,8 @@ class Protocol {
 
   void notify_out_dispatch();
 
+  crimson::common::Gated gate;
+
   /*
    * out states for writing
    */
index 794698b96e18d8242309dce19f0c27408c7ba8e5..3b16818cc62acfd9ea3db898267ae01b64a14539 100644 (file)
@@ -2159,6 +2159,7 @@ void ProtocolV2::do_close(
   }
   assert(!gate.is_closed());
   auto gate_closed = gate.close();
+  auto out_closed = close_out();
 
   if (dispatch_reset) {
     dispatchers.ms_handle_reset(
@@ -2168,7 +2169,9 @@ void ProtocolV2::do_close(
 
   // asynchronous operations
   assert(!closed_clean_fut.valid());
-  closed_clean_fut = std::move(gate_closed).then([this] {
+  closed_clean_fut = seastar::when_all(
+      std::move(gate_closed), std::move(out_closed)
+  ).discard_result().then([this] {
     if (conn.socket) {
       return conn.socket->close();
     } else {
index 40c32136b705de2127b48c09e764c6a5a28984f3..47584e702a8f6e44675b4815f50787ef783fa4fa 100644 (file)
@@ -62,6 +62,8 @@ class ProtocolV2 final : public Protocol {
 
   AuthConnectionMetaRef auth_meta;
 
+  crimson::common::Gated gate;
+
   bool closed = false;
 
   // become valid only after closed == true