Mutex::Locker lock(monc_lock);
if (_hunting()) {
- auto pending_con = pending_cons.find(m->get_source_addr());
- if (pending_con == pending_cons.end() ||
- pending_con->second.get_con() != m->get_connection()) {
+ auto p = _find_pending_con(m->get_connection());
+ if (p == pending_cons.end()) {
// ignore any messages outside hunting sessions
ldout(cct, 10) << "discarding stray monitor message " << *m << dendl;
m->put();
}
// hunting
- auto found = pending_cons.find(m->get_source_addr());
+ auto found = _find_pending_con(m->get_connection());
assert(found != pending_cons.end());
int auth_err = found->second.handle_auth(m, entity_name, want_keys,
rotating_secrets.get());
void _add_conns(uint64_t global_id);
void _send_mon_message(Message *m);
+ std::map<entity_addr_t, MonConnection>::iterator _find_pending_con(
+ const ConnectionRef& con) {
+ for (auto i = pending_cons.begin(); i != pending_cons.end(); ++i) {
+ if (i->second.get_con() == con) {
+ return i;
+ }
+ }
+ return pending_cons.end();
+ }
+
public:
void set_entity_name(EntityName name) { entity_name = name; }