Skip to content

Commit

Permalink
Consider all network interfaces when checking HOST option. (#245)
Browse files Browse the repository at this point in the history
* Consider all network interfaces when checking HOST option.

Signed-off-by: Carlos Agüero <[email protected]>

* Update localhost address.

Signed-off-by: Carlos Agüero <[email protected]>
  • Loading branch information
caguero authored May 17, 2021
1 parent b58e30c commit f083307
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions include/ignition/transport/Discovery.hh
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,10 @@ namespace ignition
this->SendUnicast(msg);
}

bool isSenderLocal = (std::find(this->hostInterfaces.begin(),
this->hostInterfaces.end(), _fromIp) != this->hostInterfaces.end()) ||
(_fromIp.find("127.") == 0);

// Update timestamp and cache the callbacks.
DiscoveryCallback<Pub> connectCb;
DiscoveryCallback<Pub> disconnectCb;
Expand All @@ -923,7 +927,7 @@ namespace ignition
// Check scope of the topic.
if ((publisher.Options().Scope() == Scope_t::PROCESS) ||
(publisher.Options().Scope() == Scope_t::HOST &&
_fromIp != this->hostAddr))
!isSenderLocal))
{
return;
}
Expand Down Expand Up @@ -976,7 +980,7 @@ namespace ignition
// Check scope of the topic.
if ((nodeInfo.Options().Scope() == Scope_t::PROCESS) ||
(nodeInfo.Options().Scope() == Scope_t::HOST &&
_fromIp != this->hostAddr))
!isSenderLocal))
{
continue;
}
Expand Down Expand Up @@ -1048,7 +1052,7 @@ namespace ignition
// Check scope of the topic.
if ((publisher.Options().Scope() == Scope_t::PROCESS) ||
(publisher.Options().Scope() == Scope_t::HOST &&
_fromIp != this->hostAddr))
!isSenderLocal))
{
return;
}
Expand Down

0 comments on commit f083307

Please sign in to comment.