Skip to content

Commit cc9bd4d

Browse files
committed
clarify closed and _close_reason
1 parent 43bfcb2 commit cc9bd4d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

trio_websocket/_impl.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,9 @@ def __init__(self, stream, ws_connection, *, host=None, path=None,
711711
``len()``. If a message is received that is larger than this size,
712712
then the connection is closed with code 1009 (Message Too Big).
713713
'''
714+
# NOTE: The implementation uses _close_reason for more than an advisory
715+
# purpose. It's critical internal state, indicating when the
716+
# connection is closed or closing.
714717
self._close_reason: Optional[CloseReason] = None
715718
self._id = next(self.__class__.CONNECTION_ID)
716719
self._stream = stream
@@ -751,8 +754,8 @@ def __init__(self, stream, ws_connection, *, host=None, path=None,
751754
@property
752755
def closed(self):
753756
'''
754-
(Read-only) The reason why the connection was closed, or ``None`` if the
755-
connection is still open.
757+
(Read-only) The reason why the connection was or is being closed,
758+
else ``None``.
756759
757760
:rtype: Optional[CloseReason]
758761
'''

0 commit comments

Comments
 (0)