From 2887fccf2f282700fa542a8535767de53a5b44ae Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sun, 16 Feb 2020 09:00:47 +0800 Subject: [PATCH] crimson/osd: refactor OSD::stop_asok_admin() the comment does not apply anymore, since `admin` and `asok` are created in the constructor. Signed-off-by: Kefu Chai --- src/crimson/osd/osd.cc | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index dd877c80f58..18b6fa62a86 100644 --- a/src/crimson/osd/osd.cc +++ b/src/crimson/osd/osd.cc @@ -414,33 +414,10 @@ seastar::future<> OSD::start_asok_admin() }); } -/* - Note: stop_asok_admin() is executed as part of a destruction process, - and may occur even before 'start' is complete. We thus take nothing for granted, - and all interfaces are checked for existence. -*/ seastar::future<> OSD::stop_asok_admin() { - return ([this] { - if (admin) { - return admin->unregister_admin_commands(); - } else { - return seastar::make_ready_future<>(); - } - })().then([this] { - if (asok) { - return asok->stop().then([this]() { - asok.release(); - return seastar::make_ready_future<>(); - }); - } else { - return seastar::make_ready_future<>(); - } - }).handle_exception([](auto ep) { - logger().error("exception on admin-stop: {}", ep); - return seastar::make_ready_future<>(); - }).finally([] { - logger().info("OSD::stop_asok_admin(): Admin-sock service destructed"); + return admin->unregister_admin_commands().then([this] { + return asok->stop(); }); } -- 2.39.5