]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: unshare conn for ProtocolV2 and Protocol
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 2 Dec 2022 08:56:13 +0000 (16:56 +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
src/crimson/net/SocketConnection.cc

index f1e7d2bb0dad30116732e7c93c9b68a2d0b1c439..215c951331ec2e64dc27bc46aa50152b877508dd 100644 (file)
@@ -129,8 +129,6 @@ class Protocol {
 
   ChainedDispatchers& dispatchers;
 
-  SocketConnection &conn;
-
  private:
   bool is_out_queued() const {
     return (!out_pending_msgs.empty() ||
@@ -156,6 +154,8 @@ class Protocol {
 
   void do_in_dispatch();
 
+  SocketConnection &conn;
+
   crimson::common::Gated gate;
 
   FrameAssemblerV2Ref frame_assembler;
index 8c3c2e54806a3ca74e98da00333f1ae484cea561..a99dd0d4bf980b3489865077e49e065d504e75f0 100644 (file)
@@ -156,10 +156,10 @@ seastar::future<> ProtocolV2::Timer::backoff(double seconds)
 }
 
 ProtocolV2::ProtocolV2(ChainedDispatchers& dispatchers,
-                       SocketConnection& conn,
-                       SocketMessenger& messenger)
+                       SocketConnection& conn)
   : Protocol(dispatchers, conn),
-    messenger{messenger},
+    conn{conn},
+    messenger{conn.messenger},
     frame_assembler{FrameAssemblerV2::create(conn)},
     auth_meta{seastar::make_lw_shared<AuthConnectionMeta>()},
     protocol_timer{conn}
index 0b915540adccc6544866825f8a7cf9c33baa7771..d60b1be83b449e84e99f2c1f365a3d7f38ead597 100644 (file)
@@ -14,8 +14,7 @@ class ProtocolV2 final : public Protocol {
 
  public:
   ProtocolV2(ChainedDispatchers& dispatchers,
-             SocketConnection& conn,
-             SocketMessenger& messenger);
+             SocketConnection& conn);
   ~ProtocolV2() override;
 
 // public to SocketConnection, but private to the others
@@ -58,6 +57,8 @@ class ProtocolV2 final : public Protocol {
   }
 
  private:
+  SocketConnection &conn;
+
   SocketMessenger &messenger;
 
   bool has_socket = false;
index 9f989e21c2f7f55afae283b2944df4e2bd11fd5c..e4a2d7d789b6cdf3eee88a840c17145b48d17f8b 100644 (file)
@@ -29,7 +29,7 @@ SocketConnection::SocketConnection(SocketMessenger& messenger,
                                    ChainedDispatchers& dispatchers)
   : core(messenger.shard_id()),
     messenger(messenger),
-    protocol(std::make_unique<ProtocolV2>(dispatchers, *this, messenger))
+    protocol(std::make_unique<ProtocolV2>(dispatchers, *this))
 {
 #ifdef UNIT_TESTS_BUILT
   if (messenger.interceptor) {