From: Yingxin Cheng Date: Tue, 18 Oct 2022 08:23:01 +0000 (+0800) Subject: crimson/net: drop Protocol::proto_type X-Git-Tag: v18.1.0~967^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6f61b08c227f7e102d91e8826b22a5c4d71c6541;p=ceph.git crimson/net: drop Protocol::proto_type Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/net/Protocol.cc b/src/crimson/net/Protocol.cc index fe5189bb775..97f48ab91ba 100644 --- a/src/crimson/net/Protocol.cc +++ b/src/crimson/net/Protocol.cc @@ -20,11 +20,9 @@ namespace { namespace crimson::net { -Protocol::Protocol(proto_t type, - ChainedDispatchers& dispatchers, +Protocol::Protocol(ChainedDispatchers& dispatchers, SocketConnection& conn) - : proto_type(type), - dispatchers(dispatchers), + : dispatchers(dispatchers), conn(conn) {} diff --git a/src/crimson/net/Protocol.h b/src/crimson/net/Protocol.h index e34d2d1d11b..83f5bf19b91 100644 --- a/src/crimson/net/Protocol.h +++ b/src/crimson/net/Protocol.h @@ -16,12 +16,6 @@ namespace crimson::net { class Protocol { public: - enum class proto_t { - none, - v1, - v2 - }; - Protocol(Protocol&&) = delete; virtual ~Protocol(); @@ -57,8 +51,7 @@ class Protocol { virtual void print(std::ostream&) const = 0; protected: - Protocol(proto_t type, - ChainedDispatchers& dispatchers, + Protocol(ChainedDispatchers& dispatchers, SocketConnection& conn); virtual void trigger_close() = 0; @@ -82,7 +75,6 @@ class Protocol { bool require_ack); public: - const proto_t proto_type; SocketRef socket; protected: diff --git a/src/crimson/net/ProtocolV2.cc b/src/crimson/net/ProtocolV2.cc index d70b0114714..3bacb48c957 100644 --- a/src/crimson/net/ProtocolV2.cc +++ b/src/crimson/net/ProtocolV2.cc @@ -151,7 +151,7 @@ seastar::future<> ProtocolV2::Timer::backoff(double seconds) ProtocolV2::ProtocolV2(ChainedDispatchers& dispatchers, SocketConnection& conn, SocketMessenger& messenger) - : Protocol(proto_t::v2, dispatchers, conn), + : Protocol(dispatchers, conn), messenger{messenger}, auth_meta{seastar::make_lw_shared()}, protocol_timer{conn} @@ -1137,7 +1137,7 @@ ProtocolV2::handle_existing_connection(SocketConnectionRef existing_conn) logger().warn("{} server_connect:" " existing connection {} is a lossy channel. Close existing in favor of" " this connection", conn, *existing_conn); - execute_establishing(existing_conn, true); + execute_establishing(existing_conn); return seastar::make_ready_future(next_step_t::ready); } @@ -1258,19 +1258,9 @@ ProtocolV2::server_connect() SocketConnectionRef existing_conn = messenger.lookup_conn(conn.peer_addr); if (existing_conn) { - if (existing_conn->protocol->proto_type != proto_t::v2) { - logger().warn("{} existing connection {} proto version is {}, close existing", - conn, *existing_conn, - static_cast(existing_conn->protocol->proto_type)); - // should unregister the existing from msgr atomically - // NOTE: this is following async messenger logic, but we may miss the reset event. - execute_establishing(existing_conn, false); - return seastar::make_ready_future(next_step_t::ready); - } else { - return handle_existing_connection(existing_conn); - } + return handle_existing_connection(existing_conn); } else { - execute_establishing(nullptr, true); + execute_establishing(nullptr); return seastar::make_ready_future(next_step_t::ready); } }); @@ -1364,16 +1354,6 @@ ProtocolV2::server_reconnect() return send_reset(true); } - if (existing_conn->protocol->proto_type != proto_t::v2) { - logger().warn("{} server_reconnect: existing connection {} proto version is {}," - "close existing and reset client.", - conn, *existing_conn, - static_cast(existing_conn->protocol->proto_type)); - // NOTE: this is following async messenger logic, but we may miss the reset event. - existing_conn->mark_down(); - return send_reset(true); - } - ProtocolV2 *existing_proto = dynamic_cast( existing_conn->protocol.get()); ceph_assert(existing_proto); @@ -1574,8 +1554,7 @@ seastar::future<> ProtocolV2::finish_auth() // ESTABLISHING -void ProtocolV2::execute_establishing( - SocketConnectionRef existing_conn, bool dispatch_reset) { +void ProtocolV2::execute_establishing(SocketConnectionRef existing_conn) { if (unlikely(state != state_t::ACCEPTING)) { logger().debug("{} triggered {} before execute_establishing()", conn, get_state_name(state)); @@ -1593,7 +1572,8 @@ void ProtocolV2::execute_establishing( trigger_state(state_t::ESTABLISHING, write_state_t::delay, false); if (existing_conn) { - existing_conn->protocol->close(dispatch_reset, std::move(accept_me)); + existing_conn->protocol->close( + true /* dispatch_reset */, std::move(accept_me)); if (unlikely(state != state_t::ESTABLISHING)) { logger().warn("{} triggered {} during execute_establishing(), " "the accept event will not be delivered!", diff --git a/src/crimson/net/ProtocolV2.h b/src/crimson/net/ProtocolV2.h index df5e7bbb4bf..fa76544e72a 100644 --- a/src/crimson/net/ProtocolV2.h +++ b/src/crimson/net/ProtocolV2.h @@ -196,7 +196,7 @@ class ProtocolV2 final : public Protocol { seastar::future<> finish_auth(); // ESTABLISHING - void execute_establishing(SocketConnectionRef existing_conn, bool dispatch_reset); + void execute_establishing(SocketConnectionRef existing_conn); // ESTABLISHING/REPLACING (server) seastar::future<> send_server_ident();