Skip to content

Commit

Permalink
Fixed incorrect dropping of discovery request (https://issues.redhat.…
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Oct 4, 2024
1 parent cfd8df5 commit f493b49
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/org/jgroups/protocols/Discovery.java
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,16 @@ else if(!cluster_name.equals(hdr.cluster_name)) {
}
if(max_rank_to_reply > 0 && hdr.initialDiscovery() && Util.getRank(view, local_addr) > max_rank_to_reply)
return null;
// Only send a response if hdr.mbrs is not empty and contains myself. Otherwise, always send my info
if (data != null && data.stream().map(PingData::mbrs).filter(Objects::nonNull).anyMatch(mbrs -> mbrs.contains(local_addr)))
return null;
// Drop the response if PingData.mbrs is not empty/null and doesn't contain myself
// Otherwise, (mbrs==null) always send a response
if(data != null) {
List<? extends Address> list=data.stream()
.map(PingData::mbrs)
.filter(Objects::nonNull)
.flatMap(Collection::stream).collect(Collectors.toList());
if(!list.isEmpty() && !list.contains(local_addr))
return null;
}
PhysicalAddress physical_addr=(PhysicalAddress)down(new Event(Event.GET_PHYSICAL_ADDRESS, local_addr));
PingData p=new PingData(local_addr, is_server, NameCache.get(local_addr), physical_addr).coord(is_coord);
sendDiscoveryResponse(List.of(p), msg.src());
Expand Down

0 comments on commit f493b49

Please sign in to comment.