@@ -107,7 +107,7 @@ class Session:
107107 _connection_condition : asyncio .Condition
108108
109109 # ws state
110- _ws_unwrapped : ClientConnection | None
110+ _ws : ClientConnection | None
111111 _heartbeat_misses : int
112112 _retry_connection_callback : RetryConnectionCallback | None
113113
@@ -146,7 +146,7 @@ def __init__(
146146 self ._connection_condition = asyncio .Condition ()
147147
148148 # ws state
149- self ._ws_unwrapped = None
149+ self ._ws = None
150150 self ._heartbeat_misses = 0
151151 self ._retry_connection_callback = retry_connection_callback
152152
@@ -352,7 +352,7 @@ async def websocket_closed_callback() -> None:
352352 last_error = None
353353 rate_limiter .start_restoring_budget (client_id )
354354 self ._state = SessionState .ACTIVE
355- self ._ws_unwrapped = ws
355+ self ._ws = ws
356356
357357 # We're connected, wake everybody up
358358 async with self ._connection_condition :
@@ -495,7 +495,7 @@ async def close(self) -> None:
495495 """Close the session and all associated streams."""
496496 logger .info (
497497 f"{ self ._transport_id } closing session "
498- f"to { self ._to_id } , ws: { self ._ws_unwrapped } "
498+ f"to { self ._to_id } , ws: { self ._ws } "
499499 )
500500 if self ._state in TerminalStates :
501501 # already closing
@@ -516,10 +516,10 @@ async def close(self) -> None:
516516 await asyncio .gather (* [x .join () for x in self ._streams .values ()])
517517 self ._streams .clear ()
518518
519- if self ._ws_unwrapped :
519+ if self ._ws :
520520 # The Session isn't guaranteed to live much longer than this close()
521521 # invocation, so let's await this close to avoid dropping the socket.
522- await self ._ws_unwrapped .close ()
522+ await self ._ws .close ()
523523
524524 self ._state = SessionState .CLOSED
525525
@@ -545,7 +545,7 @@ def get_next_pending() -> TransportMessage | None:
545545
546546 def get_ws () -> ClientConnection | None :
547547 if self .is_connected ():
548- return self ._ws_unwrapped
548+ return self ._ws
549549 return None
550550
551551 async def block_until_connected () -> None :
@@ -585,13 +585,13 @@ def do_close() -> None:
585585 def _start_heartbeat (self ) -> None :
586586 async def close_websocket () -> None :
587587 logger .debug (
588- "do_close called, _state=%r, _ws_unwrapped =%r" ,
588+ "do_close called, _state=%r, _ws =%r" ,
589589 self ._state ,
590- self ._ws_unwrapped ,
590+ self ._ws ,
591591 )
592- if self ._ws_unwrapped :
593- self ._task_manager .create_task (self ._ws_unwrapped .close ())
594- self ._ws_unwrapped = None
592+ if self ._ws :
593+ self ._task_manager .create_task (self ._ws .close ())
594+ self ._ws = None
595595
596596 if self ._retry_connection_callback :
597597 self ._task_manager .create_task (self ._retry_connection_callback ())
@@ -627,9 +627,9 @@ async def transition_connecting() -> None:
627627
628628 async def connection_interrupted () -> None :
629629 self ._state = SessionState .PENDING
630- if self ._ws_unwrapped :
631- self ._task_manager .create_task (self ._ws_unwrapped .close ())
632- self ._ws_unwrapped = None
630+ if self ._ws :
631+ self ._task_manager .create_task (self ._ws .close ())
632+ self ._ws = None
633633
634634 if self ._retry_connection_callback :
635635 self ._task_manager .create_task (self ._retry_connection_callback ())
@@ -683,7 +683,7 @@ def received_message(message: TransportMessage) -> None:
683683 block_until_connected = block_until_connected ,
684684 transport_id = self ._transport_id ,
685685 get_state = lambda : self ._state ,
686- get_ws = lambda : self ._ws_unwrapped ,
686+ get_ws = lambda : self ._ws ,
687687 transition_connecting = transition_connecting ,
688688 connection_interrupted = connection_interrupted ,
689689 reset_session_close_countdown = self ._reset_session_close_countdown ,
0 commit comments