Skip to content

Commit

Permalink
Fixed CodeFactor complexity issue
Browse files Browse the repository at this point in the history
  • Loading branch information
francis-clairicia committed Jun 23, 2024
1 parent 65c3c57 commit 22beb8e
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/easynetwork/lowlevel/api_async/servers/datagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,22 +246,21 @@ async def __client_coroutine(

del datagram
null_timeout_ctx = contextlib.nullcontext()
try:
while True:
try:
with null_timeout_ctx if timeout is None else client_data.backend.timeout(timeout):
datagram = await client_data.pop_datagram()
action = self.__parse_datagram(datagram, self.__protocol)
except BaseException as exc:
action = ThrowAction(exc)
finally:
datagram = b""
try:
timeout = await action.asend(request_handler_generator)
finally:
action = None
except StopAsyncIteration:
pass
while True:
try:
with null_timeout_ctx if timeout is None else client_data.backend.timeout(timeout):
datagram = await client_data.pop_datagram()
action = self.__parse_datagram(datagram, self.__protocol)
except BaseException as exc:
action = ThrowAction(exc)
finally:
datagram = b""
try:
timeout = await action.asend(request_handler_generator)
except StopAsyncIteration:
break
finally:
action = None
finally:
await request_handler_generator.aclose()

Expand Down

0 comments on commit 22beb8e

Please sign in to comment.