From: Kefu Chai Date: Wed, 26 Jul 2017 05:54:58 +0000 (+0800) Subject: mon/MonClient: do not send_log if conn is not active anymore X-Git-Tag: v12.1.2~90^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F16576%2Fhead;p=ceph.git mon/MonClient: do not send_log if conn is not active anymore the log message to be sent will be appended to waiting_for_session instead. but we will send the logs anyway when the MonClient is authorized with the new connection. so, avoid doing this as it's not necessary. also refactor the schedule_tick() call into a scope_guard, so it is always called upon the return of the tick() method. Signed-off-by: Kefu Chai --- diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index a0cd1e923c8e..850b38d69b60 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -14,6 +14,8 @@ #include +#include "include/scope_guard.h" + #include "messages/MMonGetMap.h" #include "messages/MMonGetVersion.h" #include "messages/MMonGetVersionReply.h" @@ -737,11 +739,15 @@ void MonClient::tick() { ldout(cct, 10) << __func__ << dendl; + auto reschedule_tick = make_scope_guard([this] { + schedule_tick(); + }); + _check_auth_tickets(); if (_hunting()) { ldout(cct, 1) << "continuing hunt" << dendl; - _reopen_session(); + return _reopen_session(); } else if (active_con) { // just renew as needed utime_t now = ceph_clock_now(); @@ -764,16 +770,13 @@ void MonClient::tick() if (interval > cct->_conf->mon_client_ping_timeout) { ldout(cct, 1) << "no keepalive since " << lk << " (" << interval << " seconds), reconnecting" << dendl; - _reopen_session(); + return _reopen_session(); } - send_log(); } _un_backoff(); } - - schedule_tick(); } void MonClient::_un_backoff()