From 67c87a3573182dc4112890fa4c76d02bdf9c8561 Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Fri, 27 Nov 2020 13:38:12 +0800 Subject: [PATCH] crimson/net: link the throttling future in both v1 and v2 The current implementations are correct and will not link the throttleing future with unrelated futures. Signed-off-by: Yingxin Cheng --- src/crimson/net/ProtocolV1.cc | 5 +++-- src/crimson/net/ProtocolV2.cc | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/crimson/net/ProtocolV1.cc b/src/crimson/net/ProtocolV1.cc index 1a841a542f58a..9b6c59f892320 100644 --- a/src/crimson/net/ProtocolV1.cc +++ b/src/crimson/net/ProtocolV1.cc @@ -871,12 +871,13 @@ seastar::future<> ProtocolV1::read_message() if (unlikely(!conn.update_rx_seq(msg->get_seq()))) { // skip this message - return; + return seastar::now(); } logger().debug("{} <== #{} === {} ({})", conn, msg_ref->get_seq(), *msg_ref, msg_ref->get_type()); - std::ignore = dispatcher->ms_dispatch(&conn, std::move(msg_ref)); + // throttle the reading process by the returned future + return dispatchers.ms_dispatch(&conn, std::move(msg_ref)); }); } diff --git a/src/crimson/net/ProtocolV2.cc b/src/crimson/net/ProtocolV2.cc index 750f458bd9dfa..de1d6f55f810c 100644 --- a/src/crimson/net/ProtocolV2.cc +++ b/src/crimson/net/ProtocolV2.cc @@ -1914,7 +1914,7 @@ seastar::future<> ProtocolV2::read_message(utime_t throttle_stamp) local_conf()->ms_die_on_old_message) { ceph_assert(0 == "old msgs despite reconnect_seq feature"); } - return; + return seastar::now(); } else if (message->get_seq() > cur_seq + 1) { logger().error("{} missed message? skipped from seq {} to {}", conn, cur_seq, message->get_seq()); @@ -1932,7 +1932,8 @@ seastar::future<> ProtocolV2::read_message(utime_t throttle_stamp) // TODO: change MessageRef with seastar::shared_ptr auto msg_ref = MessageRef{message, false}; - std::ignore = dispatcher->ms_dispatch(&conn, std::move(msg_ref)); + // throttle the reading process by the returned future + return dispatchers.ms_dispatch(&conn, std::move(msg_ref)); }); } -- 2.39.5