Skip to content

Commit f493b49

Browse files
committed
Fixed incorrect dropping of discovery request (https://issues.redhat.com/browse/JGRP-2840)
1 parent cfd8df5 commit f493b49

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/org/jgroups/protocols/Discovery.java

+10-3
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,16 @@ else if(!cluster_name.equals(hdr.cluster_name)) {
360360
}
361361
if(max_rank_to_reply > 0 && hdr.initialDiscovery() && Util.getRank(view, local_addr) > max_rank_to_reply)
362362
return null;
363-
// Only send a response if hdr.mbrs is not empty and contains myself. Otherwise, always send my info
364-
if (data != null && data.stream().map(PingData::mbrs).filter(Objects::nonNull).anyMatch(mbrs -> mbrs.contains(local_addr)))
365-
return null;
363+
// Drop the response if PingData.mbrs is not empty/null and doesn't contain myself
364+
// Otherwise, (mbrs==null) always send a response
365+
if(data != null) {
366+
List<? extends Address> list=data.stream()
367+
.map(PingData::mbrs)
368+
.filter(Objects::nonNull)
369+
.flatMap(Collection::stream).collect(Collectors.toList());
370+
if(!list.isEmpty() && !list.contains(local_addr))
371+
return null;
372+
}
366373
PhysicalAddress physical_addr=(PhysicalAddress)down(new Event(Event.GET_PHYSICAL_ADDRESS, local_addr));
367374
PingData p=new PingData(local_addr, is_server, NameCache.get(local_addr), physical_addr).coord(is_coord);
368375
sendDiscoveryResponse(List.of(p), msg.src());

0 commit comments

Comments
 (0)