When disconnecting switches, dpset will fail to unregister ports,
because size of values in the port state dictionary might be
changed when doing the iteration.
This patch fixes to copy the values list and fixes this problem.

Signed-off-by: IWASE Yusuke <iwase.yusu...@gmail.com>
 ryu/controller/dpset.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ryu/controller/dpset.py b/ryu/controller/dpset.py
index 5af6835..8004b2a 100644
--- a/ryu/controller/dpset.py
+++ b/ryu/controller/dpset.py
@@ -218,7 +218,7 @@ class DPSet(app_manager.RyuApp):
         # Now datapath is already dead, so port status change event doesn't
         # interfere us.
         ev = EventDP(dp, False)
-        for port in self.port_state.get(dp.id, {}).values():
+        for port in list(self.port_state.get(dp.id, {}).values()):
             self._port_deleted(dp, port)

Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Ryu-devel mailing list

Reply via email to