From: Yingxin Cheng Date: Wed, 11 Sep 2019 06:27:53 +0000 (+0800) Subject: crimson/net: chain non-discardable futures X-Git-Tag: v15.1.0~1515^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7324f9bd6ecca60324e7fc05c4db92d751bb3798;p=ceph.git crimson/net: chain non-discardable futures Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/net/ProtocolV2.cc b/src/crimson/net/ProtocolV2.cc index 5022303ac290..71203675b47f 100644 --- a/src/crimson/net/ProtocolV2.cc +++ b/src/crimson/net/ProtocolV2.cc @@ -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 {}" diff --git a/src/crimson/net/SocketMessenger.cc b/src/crimson/net/SocketMessenger.cc index edc47378447a..9bcad634afd2 100644 --- a/src/crimson/net/SocketMessenger.cc +++ b/src/crimson/net/SocketMessenger.cc @@ -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( msgr, *msgr.dispatcher, get_myaddr().is_msgr2()); conn->start_accept(std::move(sock), peer_addr); diff --git a/src/test/crimson/test_messenger.cc b/src/test/crimson/test_messenger.cc index d257bea76c7d..7438b015d33f 100644 --- a/src/test/crimson/test_messenger.cc +++ b/src/test/crimson/test_messenger.cc @@ -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()); - (*conn)->send(make_message()); + return (*conn)->send(make_message()).then([conn] { + return (*conn)->send(make_message()); + }); }).then([server] { return server->wait(); }).finally([client] {