From: Kefu Chai Date: Mon, 3 Sep 2018 16:14:23 +0000 (+0800) Subject: crimson/net: s/repeat/keep_doing/ X-Git-Tag: v14.0.1~418^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F23898%2Fhead;p=ceph.git crimson/net: s/repeat/keep_doing/ repeat ~= while() {} keep_doing ~= for (;;) {} so it's simpler this way. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/net/SocketMessenger.cc b/src/crimson/net/SocketMessenger.cc index f601d223f6cb..6000991fd3d7 100644 --- a/src/crimson/net/SocketMessenger.cc +++ b/src/crimson/net/SocketMessenger.cc @@ -45,7 +45,7 @@ seastar::future<> SocketMessenger::dispatch(ConnectionRef conn) std::ignore = i; ceph_assert(added); - return seastar::repeat([=] { + return seastar::keep_doing([=] { return conn->read_message() .then([=] (MessageRef msg) { if (msg) { @@ -53,8 +53,6 @@ seastar::future<> SocketMessenger::dispatch(ConnectionRef conn) } else { return seastar::now(); } - }).then([] { - return seastar::stop_iteration::no; }); }).handle_exception_type([=] (const std::system_error& e) { if (e.code() == error::connection_aborted || @@ -96,7 +94,7 @@ seastar::future<> SocketMessenger::start(Dispatcher *disp) // start listening if bind() was called if (listener) { - seastar::repeat([this] { + seastar::keep_doing([this] { return listener->accept() .then([this] (seastar::connected_socket socket, seastar::socket_address paddr) { @@ -104,7 +102,6 @@ seastar::future<> SocketMessenger::start(Dispatcher *disp) accept(std::move(socket), paddr) .handle_exception([] (std::exception_ptr eptr) {}); // don't wait before accepting another - return seastar::stop_iteration::no; }); }).handle_exception_type([this] (const std::system_error& e) { // stop gracefully on connection_aborted