]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/MonClient: change pending_cons to addrvec-based map
authorSage Weil <sage@redhat.com>
Fri, 13 Jul 2018 22:00:59 +0000 (17:00 -0500)
committerSage Weil <sage@redhat.com>
Fri, 21 Dec 2018 21:31:32 +0000 (15:31 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/MonClient.cc
src/mon/MonClient.h

index b762b892cb49b7e0d6c09533307b93ac81d6ca38..f4587b777ef0d10314d14f99fc4568c2227a0e5d 100644 (file)
@@ -662,13 +662,13 @@ void MonClient::_reopen_session(int rank)
 
 MonConnection& MonClient::_add_conn(unsigned rank, uint64_t global_id)
 {
-  auto peer = monmap.get_addr(rank);
-  auto conn = messenger->connect_to_mon(monmap.get_addrs(rank));
+  auto peer = monmap.get_addrs(rank);
+  auto conn = messenger->connect_to_mon(peer);
   MonConnection mc(cct, conn, global_id);
   auto inserted = pending_cons.insert(make_pair(peer, move(mc)));
   ldout(cct, 10) << "picked mon." << monmap.get_name(rank)
                  << " con " << conn
-                 << " addr " << conn->get_peer_addr()
+                 << " addr " << peer
                  << dendl;
   return inserted.first->second;
 }
@@ -707,19 +707,23 @@ bool MonClient::ms_handle_reset(Connection *con)
     return false;
 
   if (_hunting()) {
-    if (pending_cons.count(con->get_peer_addr())) {
-      ldout(cct, 10) << __func__ << " hunted mon " << con->get_peer_addr() << dendl;
+    if (pending_cons.count(con->get_peer_addrs())) {
+      ldout(cct, 10) << __func__ << " hunted mon " << con->get_peer_addrs()
+                    << dendl;
     } else {
-      ldout(cct, 10) << __func__ << " stray mon " << con->get_peer_addr() << dendl;
+      ldout(cct, 10) << __func__ << " stray mon " << con->get_peer_addrs()
+                    << dendl;
     }
     return true;
   } else {
     if (active_con && con == active_con->get_con()) {
-      ldout(cct, 10) << __func__ << " current mon " << con->get_peer_addr() << dendl;
+      ldout(cct, 10) << __func__ << " current mon " << con->get_peer_addrs()
+                    << dendl;
       _reopen_session();
       return false;
     } else {
-      ldout(cct, 10) << "ms_handle_reset stray mon " << con->get_peer_addr() << dendl;
+      ldout(cct, 10) << "ms_handle_reset stray mon " << con->get_peer_addrs()
+                    << dendl;
       return true;
     }
   }
index 83561803e3b38b21f8f620dc44f37725efbf79e9..6ac86687d09b281f3957282865bf433bb8851a74 100644 (file)
@@ -152,7 +152,7 @@ private:
   Messenger *messenger;
 
   std::unique_ptr<MonConnection> active_con;
-  std::map<entity_addr_t, MonConnection> pending_cons;
+  std::map<entity_addrvec_t, MonConnection> pending_cons;
 
   EntityName entity_name;
 
@@ -219,7 +219,7 @@ private:
   void _add_conns(uint64_t global_id);
   void _send_mon_message(Message *m);
 
-  std::map<entity_addr_t, MonConnection>::iterator _find_pending_con(
+  std::map<entity_addrvec_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) {