From 7a7e869c0a7d96e1e242929755c3af73085d00ac Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Wed, 24 Feb 2021 14:16:04 +0000 Subject: [PATCH] crimson: do not use ProtocolV1 anymore. At the moment crimson offers only a partial and buggy support for ProtocolV1. When it enters the production, V1 will be long obsolete, so spending time on improving it doesn't seem to be a sound investment while offering half-baked feature can be worse that lacking it entirely. Signed-off-by: Radoslaw Zarzynski --- src/crimson/net/SocketConnection.cc | 12 +++--------- src/crimson/net/SocketConnection.h | 3 +-- src/crimson/net/SocketMessenger.cc | 15 +++++++++------ 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/crimson/net/SocketConnection.cc b/src/crimson/net/SocketConnection.cc index 623dca32f0b..0c734409252 100644 --- a/src/crimson/net/SocketConnection.cc +++ b/src/crimson/net/SocketConnection.cc @@ -14,7 +14,6 @@ #include "SocketConnection.h" -#include "ProtocolV1.h" #include "ProtocolV2.h" #include "SocketMessenger.h" @@ -26,15 +25,10 @@ using namespace crimson::net; using crimson::common::local_conf; SocketConnection::SocketConnection(SocketMessenger& messenger, - ChainedDispatchers& dispatchers, - bool is_msgr2) - : messenger(messenger) + ChainedDispatchers& dispatchers) + : messenger(messenger), + protocol(std::make_unique(dispatchers, *this, messenger)) { - if (is_msgr2) { - protocol = std::make_unique(dispatchers, *this, messenger); - } else { - protocol = std::make_unique(dispatchers, *this, messenger); - } #ifdef UNIT_TESTS_BUILT if (messenger.interceptor) { interceptor = messenger.interceptor; diff --git a/src/crimson/net/SocketConnection.h b/src/crimson/net/SocketConnection.h index 9c977c7cf66..bb38750424f 100644 --- a/src/crimson/net/SocketConnection.h +++ b/src/crimson/net/SocketConnection.h @@ -53,8 +53,7 @@ class SocketConnection : public Connection { public: SocketConnection(SocketMessenger& messenger, - ChainedDispatchers& dispatchers, - bool is_msgr2); + ChainedDispatchers& dispatchers); ~SocketConnection() override; Messenger* get_messenger() const override; diff --git a/src/crimson/net/SocketMessenger.cc b/src/crimson/net/SocketMessenger.cc index 0a86eb0736f..12010b8625f 100644 --- a/src/crimson/net/SocketMessenger.cc +++ b/src/crimson/net/SocketMessenger.cc @@ -134,13 +134,14 @@ seastar::future<> SocketMessenger::start( dispatchers.assign(_dispatchers); if (listener) { // make sure we have already bound to a valid address - ceph_assert(get_myaddr().is_legacy() || get_myaddr().is_msgr2()); + ceph_assert(get_myaddr().is_msgr2()); ceph_assert(get_myaddr().get_port() > 0); return listener->accept([this] (SocketRef socket, entity_addr_t peer_addr) { assert(seastar::this_shard_id() == master_sid); - SocketConnectionRef conn = seastar::make_shared( - *this, dispatchers, get_myaddr().is_msgr2()); + assert(get_myaddr().is_msgr2()); + SocketConnectionRef conn = + seastar::make_shared(*this, dispatchers); conn->start_accept(std::move(socket), peer_addr); return seastar::now(); }); @@ -154,15 +155,17 @@ SocketMessenger::connect(const entity_addr_t& peer_addr, const entity_name_t& pe assert(seastar::this_shard_id() == master_sid); // make sure we connect to a valid peer_addr - ceph_assert(peer_addr.is_legacy() || peer_addr.is_msgr2()); + if (!peer_addr.is_msgr2()) { + ceph_abort_msg("ProtocolV1 is no longer supported"); + } ceph_assert(peer_addr.get_port() > 0); if (auto found = lookup_conn(peer_addr); found) { logger().debug("{} connect to existing", *found); return found->shared_from_this(); } - SocketConnectionRef conn = seastar::make_shared( - *this, dispatchers, peer_addr.is_msgr2()); + SocketConnectionRef conn = + seastar::make_shared(*this, dispatchers); conn->start_connect(peer_addr, peer_name); return conn->shared_from_this(); } -- 2.39.5