From e1564aff2c6812b2104d45a5a86a31bbf6fa91e9 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 21 May 2012 13:07:16 -0700 Subject: [PATCH] mon: move election msg check into elector Signed-off-by: Sage Weil --- src/mon/Elector.cc | 7 +++++++ src/mon/Monitor.cc | 8 +------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mon/Elector.cc b/src/mon/Elector.cc index 9db0216ac38..6b91f5a8d76 100644 --- a/src/mon/Elector.cc +++ b/src/mon/Elector.cc @@ -308,6 +308,13 @@ void Elector::dispatch(Message *m) return; } + if (!mon->monmap->contains(m->get_source_addr())) { + dout(1) << "discarding election message: " << m->get_source_addr() + << " not in my monmap " << *mon->monmap << dendl; + m->put(); + return; + } + MonMap *peermap = new MonMap; peermap->decode(em->monmap_bl); if (peermap->epoch > mon->monmap->epoch) { diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 97df6e28afc..25c4a499b2f 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1691,13 +1691,7 @@ bool Monitor::_ms_dispatch(Message *m) << s->caps << dendl; } if (!is_probing() && !is_slurping()) { - if (monmap->contains(m->get_source_addr())) { - elector.dispatch(m); - } else { - dout(1) << "discarding election message: " << m->get_source_addr() << " not in my monmap " - << *monmap << dendl; - m->put(); - } + elector.dispatch(m); } else { m->put(); }