From: Haomai Wang Date: Fri, 19 Dec 2014 14:13:31 +0000 (+0800) Subject: AsyncConnection:: Avoid getting stopping connection X-Git-Tag: v0.92~84^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1c0af36c0f9d4213bbf16a40cf5877d842db6d2b;p=ceph.git 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 --- diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index 1fa1bf73f28b..5a0cf46c3c28 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);