- for (int i = 0; i < ARPPendingList.size(); i++) {
- arphost = ARPPendingList.get(i);
- if (arphost.getSent_count() < switchManager.getHostRetryCount()) {
+ logger.trace("Number of Entries in ARP Pending/Failed Lists: ARPPendingList = {}, failedARPReqList = {}",
+ ARPPendingList.size(), failedARPReqList.size());
+ for (Entry<InetAddress, ARPPending> entry : ARPPendingList.entrySet()) {
+ arphost = entry.getValue();
+
+ if (hostsDB.containsKey(arphost.getHostIP())) {
+ // this host is already learned, shouldn't be in
+ // ARPPendingList
+ // Remove it and continue
+ logger.warn("Learned Host {} found in ARPPendingList", arphost.getHostIP());
+ ARPPendingList.remove(entry.getKey());
+ continue;
+ }
+ if (arphost.getSent_count() < hostRetryCount) {