Ensure H2 state is only accessed by the connection, not per-stream.#628
Ensure H2 state is only accessed by the connection, not per-stream.#628lovelydinosaur merged 2 commits intomasterfrom
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. |
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.
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.
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...