]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonClient: should update sub_sent with sub_new
authorKefu Chai <kchai@redhat.com>
Fri, 12 Aug 2016 11:19:51 +0000 (19:19 +0800)
committerLoic Dachary <ldachary@redhat.com>
Sun, 21 Aug 2016 20:23:18 +0000 (22:23 +0200)
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 <kchai@redhat.com>
(cherry picked from commit 550814900ebca9dd89e088b9abe24f66eb5e3e6d)

src/mon/MonClient.cc

index f906406f33ddaa32666c0cd2c5c8e7764fbb6add..6395918a754a72b05c1091e1abf76e020cb25470 100644 (file)
@@ -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();
   }
 }