|
17 | 17 | RemoteProtocolError, |
18 | 18 | ) |
19 | 19 | from .._models import Origin, Request, Response |
20 | | -from .._synchronization import AsyncLock, AsyncSemaphore, AsyncShieldCancellation |
| 20 | +from .._synchronization import AsyncLock, AsyncSemaphore, async_cancel_shield |
21 | 21 | from .._trace import Trace |
22 | 22 | from .interfaces import AsyncConnectionInterface |
23 | 23 |
|
@@ -108,7 +108,7 @@ async def handle_async_request(self, request: Request) -> Response: |
108 | 108 | async with Trace("send_connection_init", logger, request, kwargs): |
109 | 109 | await self._send_connection_init(**kwargs) |
110 | 110 | except BaseException as exc: |
111 | | - await AsyncShieldCancellation.shield(self.aclose) |
| 111 | + await async_cancel_shield(self.aclose) |
112 | 112 | raise exc |
113 | 113 |
|
114 | 114 | self._sent_connection_init = True |
@@ -166,7 +166,7 @@ async def close() -> None: |
166 | 166 | async with Trace("response_closed", logger, request, kwargs): |
167 | 167 | await self._response_closed(stream_id=stream_id) |
168 | 168 |
|
169 | | - await AsyncShieldCancellation.shield(close) |
| 169 | + await async_cancel_shield(close) |
170 | 170 |
|
171 | 171 | if isinstance(exc, h2.exceptions.ProtocolError): |
172 | 172 | # One case where h2 can raise a protocol error is when a |
@@ -579,7 +579,7 @@ async def __aiter__(self) -> typing.AsyncIterator[bytes]: |
579 | 579 | # If we get an exception while streaming the response, |
580 | 580 | # we want to close the response (and possibly the connection) |
581 | 581 | # before raising that exception. |
582 | | - await AsyncShieldCancellation.shield(self.aclose) |
| 582 | + await async_cancel_shield(self.aclose) |
583 | 583 | raise exc |
584 | 584 |
|
585 | 585 | async def aclose(self) -> None: |
|
0 commit comments