diff --git a/httpcore/_async/http2.py b/httpcore/_async/http2.py index 025daf02e..73705419b 100644 --- a/httpcore/_async/http2.py +++ b/httpcore/_async/http2.py @@ -306,6 +306,7 @@ async def aclose(self) -> None: # Note that this method unilaterally closes the connection, and does # not have any kind of locking in place around it. # For task-safe/thread-safe operations call into 'attempt_close' instead. + self._h2_state.close_connection() self._state = HTTPConnectionState.CLOSED await self._network_stream.aclose() diff --git a/httpcore/_sync/http2.py b/httpcore/_sync/http2.py index 97ac0ecc0..929db8512 100644 --- a/httpcore/_sync/http2.py +++ b/httpcore/_sync/http2.py @@ -306,6 +306,7 @@ def close(self) -> None: # Note that this method unilaterally closes the connection, and does # not have any kind of locking in place around it. # For task-safe/thread-safe operations call into 'attempt_close' instead. + self._h2_state.close_connection() self._state = HTTPConnectionState.CLOSED self._network_stream.close()