Signed-off-by: ISHIDA Wataru <[email protected]>
---
 ryu/app/bmpstation.py |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/ryu/app/bmpstation.py b/ryu/app/bmpstation.py
index da94d40..19072b4 100644
--- a/ryu/app/bmpstation.py
+++ b/ryu/app/bmpstation.py
@@ -53,10 +53,13 @@ class BMPStation(app_manager.RyuApp):
 
             _, len_, _ = BMPMessage.parse_header(buf)
 
-            body = sock.recv(len_ - BMPMessage._HDR_LEN)
-            if len(body) == 0:
-                self.is_active = False
-                break
+            if len_ > BMPMessage._HDR_LEN:
+                body = sock.recv(len_ - BMPMessage._HDR_LEN)
+                if len(body) == 0:
+                    self.is_active = False
+                    break
+            else:
+                body = ''
 
             msg, rest = BMPMessage.parser(buf + body)
             assert len(rest) == 0
-- 
1.7.10.4


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to