diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2016-03-02 16:17:01 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2016-03-02 16:17:01 (GMT) |
commit | e076ffb068ce4e76a7103451c3bef79c2610f791 (patch) | |
tree | de92e99ab9d04635d20adfdff6003e3c0d40f9cf /Lib/asyncio | |
parent | f9e1f2bda930054eed3115e19e9f3f7bfc83c1b6 (diff) | |
download | cpython-e076ffb068ce4e76a7103451c3bef79c2610f791.zip cpython-e076ffb068ce4e76a7103451c3bef79c2610f791.tar.gz cpython-e076ffb068ce4e76a7103451c3bef79c2610f791.tar.bz2 |
asyncio: Remove duplicate bind addresses in create_server.
Patch by Sebastien Bourdeauducq (issue #26338)
Diffstat (limited to 'Lib/asyncio')
-rw-r--r-- | Lib/asyncio/base_events.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 4505732..9d07673 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -880,7 +880,10 @@ class BaseEventLoop(events.AbstractEventLoop): to host and port. The host parameter can also be a sequence of strings and in that case - the TCP server is bound to all hosts of the sequence. + the TCP server is bound to all hosts of the sequence. If a host + appears multiple times (possibly indirectly e.g. when hostnames + resolve to the same IP address), the server is only bound once to that + host. Return a Server object which can be used to stop the service. @@ -909,7 +912,7 @@ class BaseEventLoop(events.AbstractEventLoop): flags=flags) for host in hosts] infos = yield from tasks.gather(*fs, loop=self) - infos = itertools.chain.from_iterable(infos) + infos = set(itertools.chain.from_iterable(infos)) completed = False try: |