It is dangerous to set need_addr = true as it means someone may set the
addr to something else (specifically the port) in a racing thread.
However, it is not necessary: the only reason we added it way back in
5d5045d31a9e10d21b44eb1bd137db9ae53128ff was so that
local_connection->peer_addr would get updated, and bind() now calls that
unconditionally.
Fixes: #9079
Backport: firefly
Signed-off-by: Sage Weil <sage@redhat.com>
{
ldout(msgr->cct,1) << "accepter.rebind avoid " << avoid_ports << dendl;
- // invalidate our previously learned address.
- msgr->unlearn_addr();
-
entity_addr_t addr = msgr->get_myaddr();
set<int> new_avoid = avoid_ports;
new_avoid.insert(addr.get_port());
lock.Unlock();
}
-void SimpleMessenger::unlearn_addr()
-{
- lock.Lock();
- need_addr = true;
- lock.Unlock();
-}
-
void SimpleMessenger::init_local_connection()
{
local_connection->peer_addr = my_inst.addr;
*/
void learned_addr(const entity_addr_t& peer_addr_for_me);
- /**
- * Tell the SimpleMessenger its address is no longer known
- *
- * This happens when we rebind to a new port.
- */
- void unlearn_addr();
-
/**
* Release memory accounting back to the dispatch throttler.
*