]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: group write-related general implementations
authorYingxin Cheng <yingxincheng@gmail.com>
Thu, 25 Apr 2019 22:10:32 +0000 (06:10 +0800)
committerYingxin Cheng <yingxincheng@gmail.com>
Mon, 29 Apr 2019 07:58:03 +0000 (15:58 +0800)
Signed-off-by: Yingxin Cheng <yingxincheng@gmail.com>
src/crimson/net/Protocol.h

index 5da963753509d83764f576e288497e9c2cbb65e0..c65ddc7e6a138481ac7d270402b85fb379df4117 100644 (file)
@@ -27,10 +27,6 @@ class Protocol {
   // Reentrant closing
   seastar::future<> close();
 
-  seastar::future<> send(MessageRef msg);
-
-  seastar::future<> keepalive();
-
   virtual void start_connect(const entity_addr_t& peer_addr,
                              const entity_type_t& peer_type) = 0;
 
@@ -61,6 +57,17 @@ class Protocol {
   seastar::gate pending_dispatch;
   AuthConnectionMetaRef auth_meta;
 
+ private:
+  bool closed = false;
+  // become valid only after closed == true
+  seastar::shared_future<> close_ready;
+
+// the write state-machine
+ public:
+  seastar::future<> send(MessageRef msg);
+  seastar::future<> keepalive();
+
+ protected:
   // write_state is changed with state atomically, indicating the write
   // behavior of the according state.
   enum class write_state_t {
@@ -82,10 +89,6 @@ class Protocol {
   // wait until current state changed
   seastar::shared_promise<> state_changed;
 
-  bool closed = false;
-  // become valid only after closed == true
-  seastar::shared_future<> close_ready;
-
   bool need_keepalive = false;
   std::optional<utime_t> keepalive_ack = std::nullopt;
   bool write_dispatching = false;