]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: remove the messenger gate
authorYingxin <yingxin.cheng@intel.com>
Wed, 21 Nov 2018 22:09:49 +0000 (06:09 +0800)
committerYingxin <yingxin.cheng@intel.com>
Thu, 20 Dec 2018 19:10:17 +0000 (03:10 +0800)
There is no need to use messenger gate if SocketConnection themselves
are properly gated.

Signed-off-by: Yingxin <yingxin.cheng@intel.com>
src/crimson/net/SocketConnection.cc
src/crimson/net/SocketMessenger.cc
src/crimson/net/SocketMessenger.h

index e09d2b408e5a4d1d713fba4694c5ce1d18e4a84b..6afd6b2d6b1573df09301341a098dd22fdf62058 100644 (file)
@@ -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;
           }
index 8ec2db7b293d503b54c0426f72f1f361fa49176a..3791463455d25c7a74ffedd7abfd1939a65cf7ef 100644 (file)
@@ -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<std::unique_ptr<AuthAuthorizer>>
 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);
 }
index 077f8a2716e8e3760219604385dee11f9743e565..5977ba3a892f76123ceb83bad773e487ec1c1f5e 100644 (file)
@@ -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);