On Fri, 3 May 2013 17:39:02 +0800
Can Zhang <[email protected]> wrote:

>  Use a very loose condition to determine if the address is an IPv6 address or 
> not.
> 
> Signed-off-by: Can Zhang <[email protected]>
> ---
>  ryu/lib/hub.py | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Thanks, due to other patches, I updated your patch. How about the
following?

=
>From 277d39c379011b9ca906fdb9c7c75499e8406afa Mon Sep 17 00:00:00 2001
From: Can Zhang <[email protected]>
Date: Thu, 9 May 2013 09:08:54 -0700
Subject: [PATCH] Support bind IPv6 addresses in StreamServer

Use a very loose condition to determine if the address is an IPv6
address or not.

Signed-off-by: Can Zhang <[email protected]>
Signed-off-by: FUJITA Tomonori <[email protected]>
---
 ryu/lib/hub.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ryu/lib/hub.py b/ryu/lib/hub.py
index 4ed0a14..1cdd810 100644
--- a/ryu/lib/hub.py
+++ b/ryu/lib/hub.py
@@ -35,6 +35,7 @@ if HUB_TYPE == 'eventlet':
     import eventlet.wsgi
     import greenlet
     import ssl
+    import socket
     import traceback
 
     getcurrent = eventlet.getcurrent
@@ -78,7 +79,12 @@ if HUB_TYPE == 'eventlet':
                      spawn='default', **ssl_args):
             assert backlog is None
             assert spawn == 'default'
-            self.server = eventlet.listen(listen_info)
+
+            if ':' in listen_info[0]:
+                self.server = eventlet.listen(listen_info,
+                                              family=socket.AF_INET6)
+            else:
+                self.server = eventlet.listen(listen_info)
             if ssl_args:
                 def wrap_and_handle(sock, addr):
                     ssl_args.setdefault('server_side', True)
-- 
1.7.12.4 (Apple Git-37)


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to