]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: simplify/clean up dummy addrs used for initial members
authorSage Weil <sage@inktank.com>
Fri, 18 May 2012 01:17:18 +0000 (18:17 -0700)
committerSage Weil <sage@inktank.com>
Fri, 18 May 2012 23:23:58 +0000 (16:23 -0700)
Use a complete blank IP, but set the nonce.  This way
entity_addr_t::is_blank_ip() works.  We're also outside of the namespace of
possible addrs that the mons *could* use, which is a bit cleaner.

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/Monitor.cc

index e64739b2c4bd3d84109629785e3fa1e74b27e573..fa9c7c5229d7c3c8af9bc02695d3a14f62cd3d8c 100644 (file)
@@ -318,7 +318,7 @@ int Monitor::init()
            entity_addr_t a;
            a.set_family(AF_INET);
            for (int n=1; ; n++) {
-             a.set_port(n);
+             a.set_nonce(n);
              if (!monmap->contains(a))
                break;
            }
@@ -705,12 +705,7 @@ void Monitor::handle_probe_reply(MMonProbe *m)
 
   // new initial peer?
   if (monmap->contains(m->name)) {
-    entity_addr_t a = monmap->get_addr(m->name);
-    a.set_port(0);
-    entity_addr_t b;
-    b.set_family(AF_INET);
-    dout(1) << " a " << a <<" b " << b << dendl;
-    if (a == b) {
+    if (monmap->get_addr(m->name).is_blank_ip()) {
       dout(1) << " learned initial mon " << m->name << " addr " << m->get_source_addr() << dendl;
       monmap->set_addr(m->name, m->get_source_addr());
       m->put();