replace Packet.__iter__ which doesn't work in cases like nested iterations.

Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
 ryu/lib/packet/packet.py | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/ryu/lib/packet/packet.py b/ryu/lib/packet/packet.py
index 0661e9b..2042dd7 100644
--- a/ryu/lib/packet/packet.py
+++ b/ryu/lib/packet/packet.py
@@ -41,7 +41,6 @@ class Packet(object):
             self.protocols = []
         else:
             self.protocols = protocols
-        self.protocol_idx = 0
         if self.data:
             self._parser(parse_cls)
 
@@ -106,22 +105,12 @@ class Packet(object):
             return result[0]
         return None
 
-    def next(self):
-        try:
-            p = self.protocols[self.protocol_idx]
-        except:
-            self.protocol_idx = 0
-            raise StopIteration
-
-        self.protocol_idx += 1
-        return p
-
     def __div__(self, trailer):
         self.add_protocol(trailer)
         return self
 
     def __iter__(self):
-        return self
+        return iter(self.protocols)
 
     def __getitem__(self, idx):
         return self.protocols[idx]
-- 
1.8.3.1


------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to