]> git-server-git.apps.pok.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)
committerKefu Chai <kchai@redhat.com>
Tue, 16 Aug 2016 01:19:39 +0000 (09:19 +0800)
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>
src/mon/MonClient.cc

index cad9324b661115aac9cec17c7c4ba1c50f4e08be..36aeb7d4c38f940027b74096703da2c4cc5b840b 100644 (file)
@@ -773,7 +773,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();
   }
 }