Commit e173eb60 authored by vieira's avatar vieira Committed by Brian May

Skip empty lines on incoming routes data

If we receive no routes from server or if, for some reason, we receive
some empty lines, we should skip them instead of crashing.

Fixes on of the problems in #147.
parent 29cd75b6
...@@ -489,6 +489,7 @@ def _main(tcp_listener, udp_listener, fw, ssh_cmd, remotename, ...@@ -489,6 +489,7 @@ def _main(tcp_listener, udp_listener, fw, ssh_cmd, remotename,
def onroutes(routestr): def onroutes(routestr):
if auto_nets: if auto_nets:
for line in routestr.strip().split(b'\n'): for line in routestr.strip().split(b'\n'):
if not line: break
(family, ip, width) = line.split(b',', 2) (family, ip, width) = line.split(b',', 2)
family = int(family) family = int(family)
width = int(width) width = int(width)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment