From: Kefu Chai Date: Fri, 12 Aug 2016 11:19:51 +0000 (+0800) Subject: mon/MonClient: should update sub_sent with sub_new X-Git-Tag: v10.2.3~1^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4d37cfb6eed1737b21d9f3f18eee6169f48445b2;p=ceph.git mon/MonClient: should update sub_sent with sub_new std::map::insert() does not overwrite existing items with the same key. so we need to do this in a different way. and we will check sub_sent aftewards, so we need to keep an updated sub_sent around. Fixes: http://tracker.ceph.com/issues/17023 Signed-off-by: Kefu Chai (cherry picked from commit 550814900ebca9dd89e088b9abe24f66eb5e3e6d) --- diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index f906406f33d..6395918a754 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -779,7 +779,9 @@ void MonClient::_renew_subs() m->what = sub_new; _send_mon_message(m); - sub_sent.insert(sub_new.begin(), sub_new.end()); + // update sub_sent with sub_new + sub_new.insert(sub_sent.begin(), sub_sent.end()); + std::swap(sub_new, sub_sent); sub_new.clear(); } }