From: Yingxin Date: Wed, 21 Nov 2018 22:09:49 +0000 (+0800) Subject: crimson/net: remove the messenger gate X-Git-Tag: v14.1.0~574^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=03d435f79d9a556905361b4e3c813c72ad379ef3;p=ceph-ci.git crimson/net: remove the messenger gate There is no need to use messenger gate if SocketConnection themselves are properly gated. Signed-off-by: Yingxin --- diff --git a/src/crimson/net/SocketConnection.cc b/src/crimson/net/SocketConnection.cc index e09d2b408e5..6afd6b2d6b1 100644 --- a/src/crimson/net/SocketConnection.cc +++ b/src/crimson/net/SocketConnection.cc @@ -821,9 +821,7 @@ SocketConnection::start_connect(const entity_addr_t& _peer_addr, fut.forward_to(std::move(h.promise)); }).then([this] { // notify the dispatcher and allow them to reject the connection - return seastar::with_gate(messenger.pending_dispatch, [this] { - return dispatcher.ms_handle_connect(this); - }); + return dispatcher.ms_handle_connect(this); }).then([this] { execute_open(); }).handle_exception([this] (std::exception_ptr eptr) { @@ -873,9 +871,7 @@ SocketConnection::start_accept(seastar::connected_socket&& fd, fut.forward_to(std::move(h.promise)); }).then([this] { // notify the dispatcher and allow them to reject the connection - return seastar::with_gate(messenger.pending_dispatch, [=] { - return dispatcher.ms_handle_accept(this); - }); + return dispatcher.ms_handle_accept(this); }).then([this] { messenger.register_conn(this); messenger.unaccept_conn(this); @@ -898,7 +894,7 @@ SocketConnection::execute_open() return read_message() .then([this] (MessageRef msg) { // start dispatch, ignoring exceptions from the application layer - seastar::with_gate(messenger.pending_dispatch, [this, msg = std::move(msg)] { + seastar::with_gate(pending_dispatch, [this, msg = std::move(msg)] { return dispatcher.ms_dispatch(this, std::move(msg)) .handle_exception([] (std::exception_ptr eptr) {}); }); @@ -908,13 +904,9 @@ SocketConnection::execute_open() }).handle_exception_type([this] (const std::system_error& e) { if (e.code() == error::connection_aborted || e.code() == error::connection_reset) { - return seastar::with_gate(messenger.pending_dispatch, [this] { - return dispatcher.ms_handle_reset(this); - }); + return dispatcher.ms_handle_reset(this); } else if (e.code() == error::read_eof) { - return seastar::with_gate(messenger.pending_dispatch, [this] { - return dispatcher.ms_handle_remote_reset(this); - }); + return dispatcher.ms_handle_remote_reset(this); } else { throw e; } diff --git a/src/crimson/net/SocketMessenger.cc b/src/crimson/net/SocketMessenger.cc index 8ec2db7b293..3791463455d 100644 --- a/src/crimson/net/SocketMessenger.cc +++ b/src/crimson/net/SocketMessenger.cc @@ -95,9 +95,6 @@ seastar::future<> SocketMessenger::shutdown() }); }).finally([this] { ceph_assert(connections.empty()); - // closing connections will unblock any dispatchers that were waiting to - // send(). wait for any pending calls to finish - return pending_dispatch.close(); }); } @@ -160,15 +157,11 @@ SocketMessenger::verify_authorizer(peer_type_t peer_type, auth_proto_t protocol, bufferlist& auth) { - return seastar::with_gate(pending_dispatch, [=, &auth] { - return dispatcher->ms_verify_authorizer(peer_type, protocol, auth); - }); + return dispatcher->ms_verify_authorizer(peer_type, protocol, auth); } seastar::future> SocketMessenger::get_authorizer(peer_type_t peer_type, bool force_new) { - return seastar::with_gate(pending_dispatch, [=] { - return dispatcher->ms_get_authorizer(peer_type, force_new); - }); + return dispatcher->ms_get_authorizer(peer_type, force_new); } diff --git a/src/crimson/net/SocketMessenger.h b/src/crimson/net/SocketMessenger.h index 077f8a2716e..5977ba3a892 100644 --- a/src/crimson/net/SocketMessenger.h +++ b/src/crimson/net/SocketMessenger.h @@ -62,9 +62,6 @@ class SocketMessenger final : public Messenger { bool force_new) override; public: - // TODO: change to per-connection messenger gate - seastar::gate pending_dispatch; - void set_default_policy(const SocketPolicy& p); void set_policy(entity_type_t peer_type, const SocketPolicy& p); void set_policy_throttler(entity_type_t peer_type, Throttle* throttle);