To support the case that user specifies the host address like
'localhost', this patch removes the validation of the given address
as IPv4 address family and fixes to try listening as IPv4 by default.
Then, the validation will be handled in "eventlet.listen()".
This behavior is the same as that of before supporting the unix domain
socket.

Signed-off-by: IWASE Yusuke <[email protected]>
---
 ryu/lib/hub.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/ryu/lib/hub.py b/ryu/lib/hub.py
index 182fabf..7838a0c 100644
--- a/ryu/lib/hub.py
+++ b/ryu/lib/hub.py
@@ -112,9 +112,7 @@ if HUB_TYPE == 'eventlet':
             assert backlog is None
             assert spawn == 'default'
 
-            if netaddr.valid_ipv4(listen_info[0]):
-                self.server = eventlet.listen(listen_info)
-            elif netaddr.valid_ipv6(listen_info[0]):
+            if netaddr.valid_ipv6(listen_info[0]):
                 self.server = eventlet.listen(listen_info,
                                               family=socket.AF_INET6)
             elif os.path.isdir(os.path.dirname(listen_info[0])):
@@ -122,8 +120,7 @@ if HUB_TYPE == 'eventlet':
                 self.server = eventlet.listen(listen_info[0],
                                               family=socket.AF_UNIX)
             else:
-                raise ValueError(
-                    'Invalid listen_info: %s' % str(listen_info))
+                self.server = eventlet.listen(listen_info)
 
             if ssl_args:
                 def wrap_and_handle(sock, addr):
-- 
2.7.4


------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to