From 4df5bb586083b9cba84c9020c49106e25bd86ba5 Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Fri, 26 Apr 2019 06:10:32 +0800 Subject: [PATCH] crimson/net: group write-related general implementations Signed-off-by: Yingxin Cheng --- src/crimson/net/Protocol.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/crimson/net/Protocol.h b/src/crimson/net/Protocol.h index 5da96375350..c65ddc7e6a1 100644 --- a/src/crimson/net/Protocol.h +++ b/src/crimson/net/Protocol.h @@ -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 keepalive_ack = std::nullopt; bool write_dispatching = false; -- 2.39.5