Skip to content

Commit

Permalink
Fix another "dictionary changed size during iteration" case
Browse files Browse the repository at this point in the history
  • Loading branch information
EggPool authored Aug 21, 2019
1 parent 424f321 commit 30acfe6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions peershandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import regnet
from essentials import most_common_dict, percentage_in

__version__ = "0.0.17"
__version__ = "0.0.18"


class Peers:
Expand Down Expand Up @@ -461,7 +461,9 @@ def reset_tried(self):
def client_loop(self, node, this_target):
"""Manager loop called every 30 sec. Handles maintenance"""
try:
for key, value in self.peer_dict.items():
for key, value in dict(self.peer_dict).items():
# The dict() above is not an error or a cast,
# it's to make a copy of the dict and avoid "dictionary changed size during iteration"
host = key
port = int(value)

Expand Down

0 comments on commit 30acfe6

Please sign in to comment.