From 1c0af36c0f9d4213bbf16a40cf5877d842db6d2b Mon Sep 17 00:00:00 2001 From: Haomai Wang Date: Fri, 19 Dec 2014 22:13:31 +0800 Subject: [PATCH] AsyncConnection:: Avoid getting stopping connection Now AsyncConnection::_stop may consume a little time on deleting time events, it may occur that accepting a connection get this stopping connection because unregister call isn't met. Signed-off-by: Haomai Wang --- src/msg/async/AsyncConnection.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index 1fa1bf73f28b8..5a0cf46c3c284 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -1905,6 +1905,7 @@ void AsyncConnection::_stop() ldout(async_msgr->cct, 10) << __func__ << dendl; if (sd > 0) center->delete_file_event(sd, EVENT_READABLE|EVENT_WRITABLE); + async_msgr->unregister_conn(this); shutdown_socket(); discard_out_queue(); open_write = false; @@ -1915,7 +1916,6 @@ void AsyncConnection::_stop() for (set::iterator it = register_time_events.begin(); it != register_time_events.end(); ++it) center->delete_time_event(*it); - async_msgr->unregister_conn(this); // Here we need to dispatch "signal" event, because we want to ensure signal // it after all events called by this "_stop" has be done. center->dispatch_event_external(signal_handler); -- 2.39.5