alshabib

topo fixed: tested with 100 switches and 200 links

...@@ -158,7 +158,6 @@ public class LinkDiscovery implements TimerTask { ...@@ -158,7 +158,6 @@ public class LinkDiscovery implements TimerTask {
158 } 158 }
159 159
160 this.slowPorts.add(port.getPortNo().getPortNumber()); 160 this.slowPorts.add(port.getPortNo().getPortNumber());
161 - this.slowIterator = this.slowPorts.iterator();
162 } 161 }
163 162
164 } 163 }
...@@ -176,7 +175,6 @@ public class LinkDiscovery implements TimerTask { ...@@ -176,7 +175,6 @@ public class LinkDiscovery implements TimerTask {
176 synchronized (this) { 175 synchronized (this) {
177 if (this.slowPorts.contains(portnum)) { 176 if (this.slowPorts.contains(portnum)) {
178 this.slowPorts.remove(portnum); 177 this.slowPorts.remove(portnum);
179 - this.slowIterator = this.slowPorts.iterator();
180 178
181 } else if (this.fastPorts.contains(portnum)) { 179 } else if (this.fastPorts.contains(portnum)) {
182 this.fastPorts.remove(portnum); 180 this.fastPorts.remove(portnum);
...@@ -209,7 +207,6 @@ public class LinkDiscovery implements TimerTask { ...@@ -209,7 +207,6 @@ public class LinkDiscovery implements TimerTask {
209 this.log.debug("Setting slow port to fast: {}:{}", 207 this.log.debug("Setting slow port to fast: {}:{}",
210 this.sw.getId(), portNumber); 208 this.sw.getId(), portNumber);
211 this.slowPorts.remove(portNumber); 209 this.slowPorts.remove(portNumber);
212 - this.slowIterator = this.slowPorts.iterator();
213 this.fastPorts.add(portNumber); 210 this.fastPorts.add(portNumber);
214 this.portProbeCount.put(portNumber, new AtomicInteger(0)); 211 this.portProbeCount.put(portNumber, new AtomicInteger(0));
215 } else { 212 } else {
...@@ -277,7 +274,7 @@ public class LinkDiscovery implements TimerTask { ...@@ -277,7 +274,7 @@ public class LinkDiscovery implements TimerTask {
277 return "LinkDiscovery " + this.sw.getStringId(); 274 return "LinkDiscovery " + this.sw.getStringId();
278 } 275 }
279 276
280 - /* 277 + /**
281 * Handles an incoming LLDP packet. Creates link in topology and sends ACK 278 * Handles an incoming LLDP packet. Creates link in topology and sends ACK
282 * to port where LLDP originated. 279 * to port where LLDP originated.
283 */ 280 */
...@@ -349,7 +346,6 @@ public class LinkDiscovery implements TimerTask { ...@@ -349,7 +346,6 @@ public class LinkDiscovery implements TimerTask {
349 // Update fast and slow ports 346 // Update fast and slow ports
350 fastIterator.remove(); 347 fastIterator.remove();
351 this.slowPorts.add(portNumber); 348 this.slowPorts.add(portNumber);
352 - this.slowIterator = this.slowPorts.iterator();
353 this.portProbeCount.remove(portNumber); 349 this.portProbeCount.remove(portNumber);
354 350
355 // Remove link from topology 351 // Remove link from topology
...@@ -363,11 +359,9 @@ public class LinkDiscovery implements TimerTask { ...@@ -363,11 +359,9 @@ public class LinkDiscovery implements TimerTask {
363 } 359 }
364 360
365 // send a probe for the next slow port 361 // send a probe for the next slow port
366 - if (this.slowPorts.size() > 0) { 362 + if (!this.slowPorts.isEmpty()) {
367 - if (!this.slowIterator.hasNext()) { 363 + this.slowIterator = this.slowPorts.iterator();
368 - this.slowIterator = this.slowPorts.iterator(); 364 + while (this.slowIterator.hasNext()) {
369 - }
370 - if (this.slowIterator.hasNext()) {
371 final int portNumber = this.slowIterator.next(); 365 final int portNumber = this.slowIterator.next();
372 this.log.debug("sending slow probe to port {}", portNumber); 366 this.log.debug("sending slow probe to port {}", portNumber);
373 OFPortDesc port = findPort(portNumber); 367 OFPortDesc port = findPort(portNumber);
......