-
-
Notifications
You must be signed in to change notification settings - Fork 844
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
Ensure H2 state is only accessed by the connection, not per-stream. #628
Conversation
It's probably a good idea, provided those locks were indeed added to solve issues for HTTP/2. (It was the case for the |
Thanks, those are great pointers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! 🎉
httpx/dispatch/http2.py
Outdated
connection: HTTP2Connection, | ||
state: h2.connection.H2Connection, | ||
) -> None: | ||
def __init__(self, stream_id: int, connection: HTTP2Connection,) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting nit (I've already had these, not sure why Black doesn't reformat them):
def __init__(self, stream_id: int, connection: HTTP2Connection,) -> None: | |
def __init__(self, stream_id: int, connection: HTTP2Connection) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/psf/black#trailing-commas was changed recently, I believe psf/black#826 was the culprit responsible PR. There appears to be a follow-up PR psf/black#1164 to remedy it.
This refactor moves all the H2 state management onto the Connection class, rather than being per-stream.
I think we'll want to eventually move our stream-locks out of the stream implementation and onto HTTP2Connection instead, so eg...