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

Add high-level Listener interface #282

Merged
merged 21 commits into from
Aug 18, 2017
Merged

Conversation

njsmith
Copy link
Member

@njsmith njsmith commented Aug 11, 2017

Todo:

  • open_ssl_over_tcp_listeners
  • start_listening_server (or maybe spawn_listening_server?)
  • start_{tcp,ssl_over_tcp}_server
  • rearrange docs
  • fix tutorial
  • switch to preferring port=None instead of port=0 for "pick a
    random port" (apparently python's getaddrinfo treats them the same)
    never mind, see bpo-31198
  • maybe make open_tcp_listeners accept a list of host names? not
    sure if this is really useful. But asyncio supports it.
    OTOH twisted and tornado don't and it makes How to handle automatic port selection in open_tcp_listeners when we have multiple sockets? #283 more complicated, so never mind. We can always add it later; it's a backwards compatible change.

@codecov
Copy link

codecov bot commented Aug 11, 2017

Codecov Report

Merging #282 into master will increase coverage by 0.02%.
The diff coverage is 99.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #282      +/-   ##
==========================================
+ Coverage   99.13%   99.16%   +0.02%     
==========================================
  Files          76       79       +3     
  Lines        9269     9658     +389     
  Branches      655      686      +31     
==========================================
+ Hits         9189     9577     +388     
- Misses         62       63       +1     
  Partials       18       18
Impacted Files Coverage Δ
trio/_socket.py 100% <ø> (ø) ⬆️
trio/_highlevel_open_tcp_stream.py 96.87% <100%> (ø)
trio/_highlevel_ssl_helpers.py 100% <100%> (ø)
trio/tests/test_highlevel_open_tcp_stream.py 100% <100%> (ø)
trio/tests/test_ssl.py 100% <100%> (ø) ⬆️
trio/tests/test_highlevel_socket.py 100% <100%> (ø)
trio/_ssl.py 100% <100%> (ø) ⬆️
trio/__init__.py 100% <100%> (ø) ⬆️
trio/_highlevel_generic.py 100% <100%> (ø)
trio/_abc.py 100% <100%> (ø) ⬆️
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82ca55c...aa9428d. Read the comment docs.

No more port=None or port="" or port=bytestring -- they're not useful
and they can have weird/non-portable behavior.

Also don't accept service names (port="http") -- it would work, but
they aren't necessarily portable, I can't find evidence that anyone
uses them, and they violate TOOWTDI. I'd rather not support things I
wouldn't recommend using.

Also don't allow host=None in open_tcp_stream -- this is redundant
with the loopback address. I guess this *could* be useful in some
weird case, but we can always add it back later if someone wants it.
@njsmith
Copy link
Member Author

njsmith commented Aug 18, 2017

Actually, it looks like we need to resolve #284 before adding server helpers, so I'm going to defer that part to another PR and get this in.

@njsmith njsmith merged commit 9fe5b5e into python-trio:master Aug 18, 2017
@njsmith njsmith deleted the listener-abc branch August 18, 2017 04:22
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

Successfully merging this pull request may close these issues.

1 participant