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>
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();
}
}