]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: added msgr2 setting for SocketConnection
authorYingxin Cheng <yingxincheng@gmail.com>
Fri, 15 Feb 2019 07:12:55 +0000 (15:12 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 5 Apr 2019 03:21:18 +0000 (11:21 +0800)
Provide entrypoint for the future ProtocolV2 class.

Signed-off-by: Yingxin Cheng <yingxincheng@gmail.com>
src/crimson/net/SocketConnection.cc
src/crimson/net/SocketConnection.h
src/crimson/net/SocketMessenger.cc

index 764457a8b84401fc406f743380a5b31ac63d5b4c..6b0e0a5ce3053f42b63aa73a5741c87c89e23ac7 100644 (file)
@@ -27,11 +27,17 @@ namespace {
 }
 
 SocketConnection::SocketConnection(SocketMessenger& messenger,
-                                   Dispatcher& dispatcher)
+                                   Dispatcher& dispatcher,
+                                   bool is_msgr2)
   : messenger(messenger)
 {
   ceph_assert(&messenger.container().local() == &messenger);
-  protocol = std::make_unique<ProtocolV1>(dispatcher, *this, messenger);
+  if (is_msgr2) {
+    // TODO: ProtocolV2
+    ceph_assert(false);
+  } else {
+    protocol = std::make_unique<ProtocolV1>(dispatcher, *this, messenger);
+  }
 }
 
 SocketConnection::~SocketConnection() {}
index a3c19ddd6df2ed9ab6636cf2aad8a95930c40339..a4cf67a0aca02eb2c297ffcebbf3b867b807c8f9 100644 (file)
@@ -64,7 +64,8 @@ class SocketConnection : public Connection {
 
  public:
   SocketConnection(SocketMessenger& messenger,
-                   Dispatcher& dispatcher);
+                   Dispatcher& dispatcher,
+                   bool is_msgr2);
   ~SocketConnection() override;
 
   Messenger* get_messenger() const override;
index 6b33e01ffd384cfe20040bba699068f9bb6ce244..e0a89f927e489ee52af94b8c75c9dcb3d3b3cb08 100644 (file)
@@ -154,7 +154,7 @@ seastar::future<> SocketMessenger::do_start(Dispatcher *disp)
 #warning fixme
             // we currently do dangerous i/o from a Connection core, different from the Socket core.
             container().invoke_on(shard, [sock = std::move(socket), peer_addr, this](auto& msgr) mutable {
-                SocketConnectionRef conn = seastar::make_shared<SocketConnection>(msgr, *msgr.dispatcher);
+                SocketConnectionRef conn = seastar::make_shared<SocketConnection>(msgr, *msgr.dispatcher, false);
                 conn->start_accept(std::move(sock), peer_addr);
               });
           });
@@ -175,7 +175,7 @@ SocketMessenger::do_connect(const entity_addr_t& peer_addr, const entity_type_t&
   if (auto found = lookup_conn(peer_addr); found) {
     return seastar::make_foreign(found->shared_from_this());
   }
-  SocketConnectionRef conn = seastar::make_shared<SocketConnection>(*this, *dispatcher);
+  SocketConnectionRef conn = seastar::make_shared<SocketConnection>(*this, *dispatcher, false);
   conn->start_connect(peer_addr, peer_type);
   return seastar::make_foreign(conn->shared_from_this());
 }