]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
msg: add interface to shutdown Connection
authorPatrick Donnelly <pdonnell@ibm.com>
Tue, 13 May 2025 16:26:48 +0000 (12:26 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Wed, 1 Oct 2025 18:47:06 +0000 (14:47 -0400)
Unfortunately this doesn't work as-is because I couldn't find primitives to
flush the out_queue. It's left as a to-do for now.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
src/mon/Monitor.cc
src/msg/Connection.h
src/msg/async/AsyncConnection.cc
src/msg/async/AsyncConnection.h

index d45b2d3c4add0d806db243036399b5c0bc9467ea..f126f24c32eb4fd2f885e7f275e91a52ed39dac1 100644 (file)
@@ -4188,6 +4188,9 @@ struct AnonConnection : public Connection {
   void mark_down() override {
     // silently ignore
   }
+  void shutdown() override {
+    // silengtly ignore
+  }
   void mark_disposable() override {
     // silengtly ignore
   }
index 801d3fa200ff0cf4f122af9b8d5af76c7fa3f852..14d732973d37447bbe39f8d091771de1bd0e0634 100644 (file)
@@ -157,6 +157,12 @@ public:
    */
   virtual void mark_disposable() = 0;
 
+  /*
+   * Politely shutdown the connection.  Finish sending any messages.  This
+   * queues a connection reset event.
+   */
+  virtual void shutdown() = 0;
+
   // WARNING / FIXME: this is not populated for loopback connections
   AuthCapsInfo& get_peer_caps_info() {
     return peer_caps_info;
index 2f247535dea9f36aa08566af41a3733b9b4dfef9..3eea7ba80e4e881c434c07310488ac90ac25c49f 100644 (file)
@@ -759,6 +759,12 @@ void AsyncConnection::stop(bool queue_reset) {
   if (need_queue_reset) dispatch_queue->queue_reset(this);
 }
 
+void AsyncConnection::shutdown()
+{
+  /* FIXME: stop() discards out queue so this doesn't actually flush sent messages */
+  return stop(true);
+}
+
 void AsyncConnection::cleanup() {
   shutdown_socket();
   delete read_handler;
index 03a674871fbe264399f92c343c14c176c71465cf..4b4acd695a64d22dc70d0ff9eaf9d482f7066945 100644 (file)
@@ -237,6 +237,7 @@ private:
   void process();
   void wakeup_from(uint64_t id);
   void tick(uint64_t id);
+  void shutdown() override;
   void stop(bool queue_reset);
   void cleanup();
   PerfCounters *get_perf_counter() {