MCPcopy Create free account
hub / github.com/ceph/ceph / rebind

Method rebind

src/msg/async/AsyncMessenger.cc:656–693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

654}
655
656int AsyncMessenger::rebind(const std::set<int>& avoid_ports)
657{
658 ldout(cct,1) << __func__ << " rebind avoid " << avoid_ports << dendl;
659 ceph_assert(did_bind);
660
661 for (auto &&p : processors)
662 p->stop();
663 mark_down_all();
664
665 // adjust the nonce; we want our entity_addr_t to be truly unique.
666 nonce += 1000000;
667 ldout(cct, 10) << __func__ << " new nonce " << nonce
668 << " and addr " << get_myaddrs() << dendl;
669
670 entity_addrvec_t bound_addrs;
671 entity_addrvec_t bind_addrs = get_myaddrs();
672 std::set<int> new_avoid(avoid_ports);
673 for (auto& a : bind_addrs.v) {
674 new_avoid.insert(a.get_port());
675 a.set_port(0);
676 }
677 ldout(cct, 10) << __func__ << " will try " << bind_addrs
678 << " and avoid ports " << new_avoid << dendl;
679 unsigned i = 0;
680 for (auto &&p : processors) {
681 int r = p->bind(bind_addrs, avoid_ports, &bound_addrs);
682 if (r) {
683 ceph_assert(i == 0);
684 return r;
685 }
686 ++i;
687 }
688 _finish_bind(bind_addrs, bound_addrs);
689 for (auto &&p : processors) {
690 p->start();
691 }
692 return 0;
693}
694
695int AsyncMessenger::client_bind(const entity_addr_t &bind_addr)
696{

Callers

nothing calls this directly

Calls 6

stopMethod · 0.45
insertMethod · 0.45
get_portMethod · 0.45
set_portMethod · 0.45
bindMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected