Committed by
Gerrit Code Review
Fix NeighbourResolutionManager which always
sets the context as handled, updates learningswitch version and fixes a checkstyle error. Change-Id: I30a9abae60a808e3d610e5a7086cc7ee53720bb9 (cherry picked from commit 0ba98527)
Showing
1 changed file
with
14 additions
and
8 deletions
| ... | @@ -71,6 +71,7 @@ import java.util.Dictionary; | ... | @@ -71,6 +71,7 @@ import java.util.Dictionary; |
| 71 | import java.util.Iterator; | 71 | import java.util.Iterator; |
| 72 | import java.util.Map; | 72 | import java.util.Map; |
| 73 | import java.util.Objects; | 73 | import java.util.Objects; |
| 74 | +import java.util.stream.Collectors; | ||
| 74 | 75 | ||
| 75 | import static com.google.common.base.Preconditions.checkNotNull; | 76 | import static com.google.common.base.Preconditions.checkNotNull; |
| 76 | import static org.onlab.packet.Ethernet.TYPE_ARP; | 77 | import static org.onlab.packet.Ethernet.TYPE_ARP; |
| ... | @@ -280,19 +281,24 @@ public class NeighbourResolutionManager implements NeighbourResolutionService { | ... | @@ -280,19 +281,24 @@ public class NeighbourResolutionManager implements NeighbourResolutionService { |
| 280 | return; | 281 | return; |
| 281 | } | 282 | } |
| 282 | 283 | ||
| 283 | - handleMessage(msgContext); | 284 | + if (handleMessage(msgContext)) { |
| 285 | + context.block(); | ||
| 286 | + } | ||
| 284 | 287 | ||
| 285 | - context.block(); | ||
| 286 | } | 288 | } |
| 287 | 289 | ||
| 288 | - private void handleMessage(NeighbourMessageContext context) { | 290 | + private boolean handleMessage(NeighbourMessageContext context) { |
| 289 | Collection<NeighbourHandlerRegistration> handlers = packetHandlers.get(context.inPort()); | 291 | Collection<NeighbourHandlerRegistration> handlers = packetHandlers.get(context.inPort()); |
| 290 | 292 | ||
| 291 | - handlers.forEach(registration -> { | 293 | + Collection<NeighbourHandlerRegistration> handled = handlers |
| 292 | - if (registration.intf() == null || matches(context, registration.intf())) { | 294 | + .stream() |
| 293 | - registration.handler().handleMessage(context, hostService); | 295 | + .filter(registration -> registration.intf() == null || matches(context, registration.intf())) |
| 294 | - } | 296 | + .collect(Collectors.toSet()); |
| 295 | - }); | 297 | + |
| 298 | + handled.forEach(registration -> registration.handler().handleMessage(context, hostService)); | ||
| 299 | + | ||
| 300 | + return !handled.isEmpty(); | ||
| 301 | + | ||
| 296 | } | 302 | } |
| 297 | 303 | ||
| 298 | /** | 304 | /** | ... | ... |
-
Please register or login to post a comment