]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: chain non-discardable futures
authorYingxin Cheng <yingxin.cheng@intel.com>
Wed, 11 Sep 2019 06:27:53 +0000 (14:27 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Wed, 18 Sep 2019 04:32:31 +0000 (12:32 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/net/ProtocolV2.cc
src/crimson/net/SocketMessenger.cc
src/test/crimson/test_messenger.cc

index 5022303ac290f3c3362a98e07fc94d95e9be5518..71203675b47ffbaf8192a7809fb36b509d67ef0e 100644 (file)
@@ -1246,8 +1246,9 @@ ProtocolV2::handle_existing_connection(SocketConnectionRef existing_conn)
         logger().warn("{} server_connect: connection race detected (cs={}, e_cs={}, ss=0)"
                       " and lose to existing {}, ask client to wait",
                       conn, client_cookie, existing_proto->client_cookie, *existing_conn);
-        existing_conn->keepalive();
-        return send_wait();
+        return existing_conn->keepalive().then([this] {
+          return send_wait();
+        });
       }
     } else {
       logger().warn("{} server_connect: found client session with existing {}"
index edc47378447a426a7571c7f42cc1f9f2dacc6243..9bcad634afd2e1c6e3d6d18ed495294216e546e5 100644 (file)
@@ -169,10 +169,10 @@ seastar::future<> SocketMessenger::do_start(Dispatcher *disp)
           .then([this] (SocketFRef socket,
                         entity_addr_t peer_addr) {
             auto shard = locate_shard(peer_addr);
-            // don't wait before accepting another
 #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 {
+            return container().invoke_on(shard,
+              [sock = std::move(socket), peer_addr, this](auto& msgr) mutable {
                 SocketConnectionRef conn = seastar::make_shared<SocketConnection>(
                     msgr, *msgr.dispatcher, get_myaddr().is_msgr2());
                 conn->start_accept(std::move(sock), peer_addr);
index d257bea76c7d04bd23efc59b3b87cb8237be5a7c..7438b015d33f91c7e420535668d953da72e5b105 100644 (file)
@@ -425,8 +425,9 @@ static seastar::future<> test_concurrent_dispatch(bool v2)
                                       entity_name_t::TYPE_OSD);
         }).then([](ceph::net::ConnectionXRef conn) {
           // send two messages
-          (*conn)->send(make_message<MPing>());
-          (*conn)->send(make_message<MPing>());
+          return (*conn)->send(make_message<MPing>()).then([conn] {
+            return (*conn)->send(make_message<MPing>());
+          });
         }).then([server] {
           return server->wait();
         }).finally([client] {