Skip to content

Commit efac8b8

Browse files
Magd BayoumiMagd Bayoumi
authored andcommitted
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fix: handle http2 goaway race conditions
1 parent 83056e3 commit efac8b8

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

httpcore/_async/http2.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ async def handle_async_request(self, request: Request) -> Response:
201201
},
202202
)
203203
raise ConnectionGoingAway(
204-
self._connection_terminated, # type: ignore[arg-type]
205-
last_stream_id=self._connection_terminated.last_stream_id, # type: ignore[arg-type]
206-
error_code=self._connection_terminated.error_code, # type: ignore[arg-type]
204+
self._connection_terminated, # type: ignore[arg-type,unused-ignore]
205+
last_stream_id=self._connection_terminated.last_stream_id, # type: ignore[arg-type,unused-ignore]
206+
error_code=self._connection_terminated.error_code, # type: ignore[arg-type,unused-ignore]
207207
request_stream_id=stream_id,
208208
headers_sent=phase["headers_sent"],
209209
body_sent=phase["body_sent"],
@@ -414,7 +414,7 @@ async def _receive_events(
414414
raise ConnectionGoingAway(
415415
f"GOAWAY received: stream {stream_id} > last_stream_id {last_stream_id}",
416416
last_stream_id=last_stream_id,
417-
error_code=self._connection_terminated.error_code, # type: ignore[arg-type]
417+
error_code=self._connection_terminated.error_code, # type: ignore[arg-type,unused-ignore]
418418
request_stream_id=stream_id,
419419
headers_sent=phase["headers_sent"],
420420
body_sent=phase["body_sent"],
@@ -426,7 +426,7 @@ async def _receive_events(
426426
last_stream_id=last_stream_id
427427
if last_stream_id is not None
428428
else 0,
429-
error_code=self._connection_terminated.error_code, # type: ignore[arg-type]
429+
error_code=self._connection_terminated.error_code, # type: ignore[arg-type,unused-ignore]
430430
request_stream_id=stream_id,
431431
headers_sent=phase["headers_sent"],
432432
body_sent=phase["body_sent"],
@@ -545,7 +545,7 @@ async def _read_incoming_data(
545545
raise ConnectionGoingAway(
546546
"Server disconnected after GOAWAY",
547547
last_stream_id=last_stream_id if last_stream_id else 0,
548-
error_code=self._connection_terminated.error_code, # type: ignore[arg-type]
548+
error_code=self._connection_terminated.error_code, # type: ignore[arg-type,unused-ignore]
549549
request_stream_id=stream_id,
550550
headers_sent=phase["headers_sent"],
551551
body_sent=phase["body_sent"],

httpcore/_sync/http2.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ def handle_request(self, request: Request) -> Response:
201201
},
202202
)
203203
raise ConnectionGoingAway(
204-
self._connection_terminated, # type: ignore[arg-type]
205-
last_stream_id=self._connection_terminated.last_stream_id, # type: ignore[arg-type]
206-
error_code=self._connection_terminated.error_code, # type: ignore[arg-type]
204+
self._connection_terminated, # type: ignore[arg-type,unused-ignore]
205+
last_stream_id=self._connection_terminated.last_stream_id, # type: ignore[arg-type,unused-ignore]
206+
error_code=self._connection_terminated.error_code, # type: ignore[arg-type,unused-ignore]
207207
request_stream_id=stream_id,
208208
headers_sent=phase["headers_sent"],
209209
body_sent=phase["body_sent"],
@@ -414,7 +414,7 @@ def _receive_events(
414414
raise ConnectionGoingAway(
415415
f"GOAWAY received: stream {stream_id} > last_stream_id {last_stream_id}",
416416
last_stream_id=last_stream_id,
417-
error_code=self._connection_terminated.error_code, # type: ignore[arg-type]
417+
error_code=self._connection_terminated.error_code, # type: ignore[arg-type,unused-ignore]
418418
request_stream_id=stream_id,
419419
headers_sent=phase["headers_sent"],
420420
body_sent=phase["body_sent"],
@@ -426,7 +426,7 @@ def _receive_events(
426426
last_stream_id=last_stream_id
427427
if last_stream_id is not None
428428
else 0,
429-
error_code=self._connection_terminated.error_code, # type: ignore[arg-type]
429+
error_code=self._connection_terminated.error_code, # type: ignore[arg-type,unused-ignore]
430430
request_stream_id=stream_id,
431431
headers_sent=phase["headers_sent"],
432432
body_sent=phase["body_sent"],
@@ -545,7 +545,7 @@ def _read_incoming_data(
545545
raise ConnectionGoingAway(
546546
"Server disconnected after GOAWAY",
547547
last_stream_id=last_stream_id if last_stream_id else 0,
548-
error_code=self._connection_terminated.error_code, # type: ignore[arg-type]
548+
error_code=self._connection_terminated.error_code, # type: ignore[arg-type,unused-ignore]
549549
request_stream_id=stream_id,
550550
headers_sent=phase["headers_sent"],
551551
body_sent=phase["body_sent"],

0 commit comments

Comments
 (0)