Yuta HIGUCHI

attempt to fix NPE in LinkDiscovery

Change-Id: Iec3e2ed4a0fee2fb0c6ad9a0e383c2024efc10a0
...@@ -339,9 +339,14 @@ public class LinkDiscovery implements TimerTask { ...@@ -339,9 +339,14 @@ public class LinkDiscovery implements TimerTask {
339 final Iterator<Integer> fastIterator = this.fastPorts.iterator(); 339 final Iterator<Integer> fastIterator = this.fastPorts.iterator();
340 while (fastIterator.hasNext()) { 340 while (fastIterator.hasNext()) {
341 final Integer portNumber = fastIterator.next(); 341 final Integer portNumber = fastIterator.next();
342 + OFPortDesc port = findPort(portNumber);
343 + if (port == null) {
344 + // port can be null
345 + // #removePort modifies `ports` outside synchronized block
346 + continue;
347 + }
342 final int probeCount = this.portProbeCount.get(portNumber) 348 final int probeCount = this.portProbeCount.get(portNumber)
343 .getAndIncrement(); 349 .getAndIncrement();
344 - OFPortDesc port = findPort(portNumber);
345 if (probeCount < LinkDiscovery.MAX_PROBE_COUNT) { 350 if (probeCount < LinkDiscovery.MAX_PROBE_COUNT) {
346 this.log.debug("sending fast probe to port"); 351 this.log.debug("sending fast probe to port");
347 352
......