Skip to content

Commit

Permalink
Fix dict error in for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
hsiaohsuan1l1l committed May 28, 2016
1 parent f484483 commit c541194
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/src/floodlight_modules/busylink_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def parsePortFeatures_v1_3(self,features):
def busyLinkDetect(self):
self.BLD_result = []
# Calculate link's countBytes and capacity
for link_id in self.links:
for link_id in self.links.copy():
src = self.links[link_id]['source']
srcp = self.links[link_id]['sourcePort']
dest = self.links[link_id]['target']
Expand All @@ -155,11 +155,11 @@ def busyLinkDetect(self):
# Initialize self.statistics value
if len(self.statistics) == 0:
self.statistics = dict(self.links)
for link_id in self.statistics:
for link_id in self.statistics.copy():
self.statistics[link_id]['state'] = self.baseState

# Check threshold
for link_id in self.links:
for link_id in self.links.copy():
if link_id in self.statistics:
if (self.links[link_id]['countBytes'] - self.statistics[link_id]['countBytes']) / self.statistics[link_id]['capacity'] >= self.threshold:
self.overthreshold(link_id)
Expand Down

0 comments on commit c541194

Please sign in to comment.