]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
AsyncMessenger: ensure all events can be processed
authorHaomai Wang <haomai@xsky.com>
Tue, 24 May 2016 17:04:04 +0000 (01:04 +0800)
committerHaomai Wang <haomai@xsky.com>
Wed, 25 May 2016 01:02:18 +0000 (09:02 +0800)
Signed-off-by: Haomai Wang <haomai@xsky.com>
src/msg/async/AsyncMessenger.cc

index 8a6d0428d154ed45e9378a7a3f9c2c58dd776aa4..75cc80a7c0f09a5e3bb765e3c20907657a26e80c 100644 (file)
@@ -420,8 +420,8 @@ int AsyncMessenger::shutdown()
 
   // break ref cycles on the loopback connection
   processor.stop();
-  dispatch_queue.shutdown();
   mark_down_all();
+  dispatch_queue.shutdown();
   local_connection->set_priv(NULL);
   pool->barrier();
   lock.Lock();
@@ -506,6 +506,9 @@ void AsyncMessenger::wait()
   did_bind = false;
   ldout(cct,20) << __func__ << ": stopped processor thread" << dendl;
 
+  // close all connections
+  mark_down_all();
+
   if (dispatch_queue.is_started()) {
     ldout(cct, 10) << __func__ << ": waiting for dispatch queue" << dendl;
     dispatch_queue.wait();
@@ -513,9 +516,6 @@ void AsyncMessenger::wait()
     ldout(cct, 10) << __func__ << ": dispatch queue is stopped" << dendl;
   }
 
-  // close all connections
-  mark_down_all();
-
   ldout(cct, 10) << __func__ << ": done." << dendl;
   ldout(cct, 1) << __func__ << " complete." << dendl;
   started = false;