Skip to content

Commit

Permalink
Guard to make sure we can't send data while the transport is closing
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly committed Sep 10, 2024
1 parent d384755 commit 4dbe60a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bellows/ash.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,9 @@ def _write_frame(
prefix: tuple[Reserved] = (),
suffix: tuple[Reserved] = (Reserved.FLAG,),
) -> None:
if self._transport is None or self._transport.is_closing():
raise NcpFailure("Transport is closed, cannot send frame")

if _LOGGER.isEnabledFor(logging.DEBUG):
prefix_str = "".join([f"{r.name} + " for r in prefix])
suffix_str = "".join([f" + {r.name}" for r in suffix])
Expand Down

0 comments on commit 4dbe60a

Please sign in to comment.