crimson/net: define an alias of seastar::stop_iteration
authorKefu Chai <kchai@redhat.com>
Mon, 19 Nov 2018 07:05:51 +0000 (15:05 +0800)
committerYingxin <yingxin.cheng@intel.com>
Tue, 20 Nov 2018 13:08:29 +0000 (21:08 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/net/SocketConnection.cc
src/crimson/net/SocketConnection.h

index c9eae3a..b98fb6b 100644 (file)
@@ -79,24 +79,22 @@ void SocketConnection::read_tags_until_next_message()
           switch (buf[0]) {
           case CEPH_MSGR_TAG_MSG:
             // stop looping and notify read_header()
-            return seastar::make_ready_future<seastar::stop_iteration>(
-                seastar::stop_iteration::yes);
+            return seastar::make_ready_future<stop_t>(stop_t::yes);
           case CEPH_MSGR_TAG_ACK:
             return handle_ack();
           case CEPH_MSGR_TAG_KEEPALIVE:
             break;
           case CEPH_MSGR_TAG_KEEPALIVE2:
             return handle_keepalive2()
-              .then([this] { return seastar::stop_iteration::no; });
+              .then([this] { return stop_t::no; });
           case CEPH_MSGR_TAG_KEEPALIVE2_ACK:
             return handle_keepalive2_ack()
-              .then([this] { return seastar::stop_iteration::no; });
+              .then([this] { return stop_t::no; });
           case CEPH_MSGR_TAG_CLOSE:
             std::cout << "close" << std::endl;
             break;
           }
-          return seastar::make_ready_future<seastar::stop_iteration>(
-              seastar::stop_iteration::no);
+          return seastar::make_ready_future<stop_t>(stop_t::no);
         });
     }).handle_exception_type([this] (const std::system_error& e) {
       if (e.code() == error::read_eof) {
@@ -115,7 +113,7 @@ seastar::future<seastar::stop_iteration> SocketConnection::handle_ack()
     .then([this] (auto buf) {
       auto seq = reinterpret_cast<const ceph_le64*>(buf.get());
       discard_up_to(&sent, *seq);
-      return seastar::stop_iteration::no;
+      return stop_t::no;
     });
 }
 
index 87c8e5d..c9d3e3c 100644 (file)
@@ -27,6 +27,8 @@ class AuthSessionHandler;
 
 namespace ceph::net {
 
+using stop_t = seastar::stop_iteration;
+
 class SocketMessenger;
 class SocketConnection;
 using SocketConnectionRef = boost::intrusive_ptr<SocketConnection>;
@@ -99,7 +101,7 @@ class SocketConnection : public Connection {
 
   seastar::future<> maybe_throttle();
   void read_tags_until_next_message();
-  seastar::future<seastar::stop_iteration> handle_ack();
+  seastar::future<stop_t> handle_ack();
 
   /// becomes available when handshake completes, and when all previous messages
   /// have been sent to the output stream. send() chains new messages as