]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: STANDBY state for lossless server or peer
authorYingxin Cheng <yingxin.cheng@intel.com>
Thu, 8 Aug 2019 08:25:43 +0000 (16:25 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Mon, 12 Aug 2019 09:22:38 +0000 (17:22 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/net/Protocol.cc
src/crimson/net/Protocol.h
src/crimson/net/ProtocolV2.cc
src/crimson/net/ProtocolV2.h

index 2a70b9f4b3ecf686db596d43435968948976ef79..ba21d726c8a8996003475379d2554c947622ca3a 100644 (file)
@@ -265,6 +265,7 @@ seastar::future<stop_t> Protocol::do_write_dispatch_sweep()
 
 void Protocol::write_event()
 {
+  notify_write();
   if (write_dispatching) {
     // already dispatching
     return;
index c3d127083d82e0bd51b9aeb55011eb830b703686..f3a7443a12fd5ca6db9273e58aa0962c3139faa0 100644 (file)
@@ -47,6 +47,8 @@ class Protocol {
       std::optional<utime_t> keepalive_ack,
       bool require_ack) = 0;
 
+  virtual void notify_write() {};
+
  public:
   const proto_t proto_type;
 
index 79023d32838e8734401d464bb95246d8d091e29d..901158b8751c1e0896cc157a9b4dbb0e907f5295 100644 (file)
@@ -1759,9 +1759,17 @@ void ProtocolV2::execute_ready()
 
 void ProtocolV2::execute_standby()
 {
-  // TODO not implemented
-  // trigger_state(state_t::STANDBY, write_state_t::delay, false);
-  ceph_assert(false);
+  trigger_state(state_t::STANDBY, write_state_t::delay, true);
+  if (socket) {
+    socket->shutdown();
+  }
+}
+
+void ProtocolV2::notify_write()
+{
+  if (unlikely(state == state_t::STANDBY && !conn.policy.server)) {
+    execute_connecting();
+  }
 }
 
 // WAIT state
index bce428c6297eb931436cff1236b4ea563ee8d17f..ed880a57f325d6ff773eb8daf19b989552181fb5 100644 (file)
@@ -32,6 +32,8 @@ class ProtocolV2 final : public Protocol {
       std::optional<utime_t> keepalive_ack,
       bool require_ack) override;
 
+  void notify_write() override;
+
  private:
   SocketMessenger &messenger;