Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] server_config['port'] not set correctly for IPv6 sockets #6

Open
paulc opened this issue Dec 30, 2020 · 1 comment
Open

[BUG] server_config['port'] not set correctly for IPv6 sockets #6

paulc opened this issue Dec 30, 2020 · 1 comment

Comments

@paulc
Copy link

paulc commented Dec 30, 2020

Hi,

If you start the wdom server listening on an IPv6 address (start(address="::",port=8888)) then server_config['port'] will not be set correctly (which then causes an exception in the logger statement in start_server).

The following patch fixes this:

diff --git a/wdom/server/_tornado.py b/wdom/server/_tornado.py
index cb8aac6..df9335f 100644
--- a/wdom/server/_tornado.py
+++ b/wdom/server/_tornado.py
@@ -185,7 +185,7 @@ def start_server(app: web.Application = None, port: int = None,
     app.loop = asyncio.get_event_loop()
     server_config['address'] = address
     for sock in server._sockets.values():
-        if sock.family == socket.AF_INET:
+        if sock.family in (socket.AF_INET,socket.AF_INET6):
             server_config['port'] = sock.getsockname()[1]
             break
     return server
@QGB
Copy link

QGB commented May 15, 2021

@paulc this project not maintained anymore?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants