*/
virtual int bind(const entity_addr_t& bind_addr) = 0;
+ virtual int bindv(const entity_addrvec_t& addrs);
+
/**
* This function performs a full restart of the Messenger component,
* whatever that means. Other entities who connect to this
* is true.
* @param bind_addr The address to bind to.
* @return 0 on success, or -1 on error, or -errno if
+ * we can be more specific about the failure.
*/
virtual int client_bind(const entity_addr_t& bind_addr) = 0;
- virtual int bindv(const entity_addrvec_t& addrs);
+ /**
+ * reset the 'client' Messenger. Mark all the existing Connections down
+ * and update 'nonce'.
+ */
+ virtual int client_reset() = 0;
virtual bool should_use_msgr2() {
did_bind = true;
}
+int AsyncMessenger::client_reset()
+{
+ mark_down_all();
+
+ std::scoped_lock l{lock};
+ // adjust the nonce; we want our entity_addr_t to be truly unique.
+ nonce += 1000000;
+ ldout(cct, 10) << __func__ << " new nonce " << nonce << dendl;
+
+ entity_addrvec_t newaddrs = *my_addrs;
+ for (auto& a : newaddrs.v) {
+ a.set_nonce(nonce);
+ }
+ set_myaddrs(newaddrs);
+ _init_local_connection();
+ return 0;
+}
+
int AsyncMessenger::start()
{
std::scoped_lock l{lock};
int bind(const entity_addr_t& bind_addr) override;
int rebind(const std::set<int>& avoid_ports) override;
+ int bindv(const entity_addrvec_t& bind_addrs) override;
+
int client_bind(const entity_addr_t& bind_addr) override;
- int bindv(const entity_addrvec_t& bind_addrs) override;
+ int client_reset() override;
bool should_use_msgr2() override;