From: Yingxin Cheng Date: Fri, 15 Feb 2019 07:12:55 +0000 (+0800) Subject: crimson/net: added msgr2 setting for SocketConnection X-Git-Tag: v15.1.0~3027^2~27 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5779e4119a02ef3cb3bcf9254499e9929951457b;p=ceph.git crimson/net: added msgr2 setting for SocketConnection Provide entrypoint for the future ProtocolV2 class. Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/net/SocketConnection.cc b/src/crimson/net/SocketConnection.cc index 764457a8b844..6b0e0a5ce305 100644 --- a/src/crimson/net/SocketConnection.cc +++ b/src/crimson/net/SocketConnection.cc @@ -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(dispatcher, *this, messenger); + if (is_msgr2) { + // TODO: ProtocolV2 + ceph_assert(false); + } else { + protocol = std::make_unique(dispatcher, *this, messenger); + } } SocketConnection::~SocketConnection() {} diff --git a/src/crimson/net/SocketConnection.h b/src/crimson/net/SocketConnection.h index a3c19ddd6df2..a4cf67a0aca0 100644 --- a/src/crimson/net/SocketConnection.h +++ b/src/crimson/net/SocketConnection.h @@ -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; diff --git a/src/crimson/net/SocketMessenger.cc b/src/crimson/net/SocketMessenger.cc index 6b33e01ffd38..e0a89f927e48 100644 --- a/src/crimson/net/SocketMessenger.cc +++ b/src/crimson/net/SocketMessenger.cc @@ -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(msgr, *msgr.dispatcher); + SocketConnectionRef conn = seastar::make_shared(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(*this, *dispatcher); + SocketConnectionRef conn = seastar::make_shared(*this, *dispatcher, false); conn->start_connect(peer_addr, peer_type); return seastar::make_foreign(conn->shared_from_this()); }