From 676b8139b84333be83d61ef5ef855891c5e4fa62 Mon Sep 17 00:00:00 2001 From: Haomai Wang Date: Wed, 25 May 2016 01:04:04 +0800 Subject: [PATCH] AsyncMessenger: ensure all events can be processed Signed-off-by: Haomai Wang --- src/msg/async/AsyncMessenger.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/msg/async/AsyncMessenger.cc b/src/msg/async/AsyncMessenger.cc index 8a6d0428d15..75cc80a7c0f 100644 --- a/src/msg/async/AsyncMessenger.cc +++ b/src/msg/async/AsyncMessenger.cc @@ -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; -- 2.39.5