]> git-server-git.apps.pok.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>
Mon, 5 Jan 2026 21:23:32 +0000 (16:23 -0500)
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 a82584535d1b70343afac215c3df5576cf13d7e1..c6a4e62be769cfd6b5062d6524a6aa58c330204e 100644 (file)
@@ -4189,6 +4189,9 @@ struct AnonConnection : public Connection {
   void mark_down() override {
     // silently ignore
   }
+  void shutdown() override {
+    // silengtly ignore
+  }
   void mark_disposable() override {
     // silengtly ignore
   }
index 1e1dfd1aa3c2343bb99d04b5cc14bbdc868a16b1..ce167343711bdde8fc826a4c2bf9eb053428962f 100644 (file)
@@ -158,6 +158,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 17836b14ad27bd237c4bb60b619b7fbd323de902..52d1330f24e1d6602fc50b6c08a17035ca492c31 100644 (file)
@@ -760,6 +760,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 4529313302342290a752a3c85706e2b9ac1f5932..ac11fd1ae9dc919c7bd8bcac5c167130912b191f 100644 (file)
@@ -238,6 +238,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() {