Skip to content

Commit

Permalink
Uniformize comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaugustin committed Nov 11, 2024
1 parent f17c11a commit bdfc8cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/websockets/asyncio/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ async def get(self, decode: bool | None = None) -> Data:

self.get_in_progress = True

# Locking with get_in_progress prevents concurrent execution until
# get() fetches a complete message or is cancelled.
# Locking with get_in_progress prevents concurrent execution
# until get() fetches a complete message or is cancelled.

try:
# First frame
Expand Down Expand Up @@ -208,8 +208,8 @@ async def get_iter(self, decode: bool | None = None) -> AsyncIterator[Data]:

self.get_in_progress = True

# Locking with get_in_progress prevents concurrent execution until
# get_iter() fetches a complete message or is cancelled.
# Locking with get_in_progress prevents concurrent execution
# until get_iter() fetches a complete message or is cancelled.

# If get_iter() raises an exception e.g. in decoder.decode(),
# get_in_progress remains set and the connection becomes unusable.
Expand Down
11 changes: 5 additions & 6 deletions src/websockets/sync/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,11 @@ def get(self, timeout: float | None = None, decode: bool | None = None) -> Data:

if self.get_in_progress:
raise ConcurrencyError("get() or get_iter() is already running")

# Locking with get_in_progress ensures only one thread can get here.
self.get_in_progress = True

# Locking with get_in_progress prevents concurrent execution
# until get() fetches a complete message or times out.

try:
deadline = Deadline(timeout)

Expand Down Expand Up @@ -198,12 +199,10 @@ def get_iter(self, decode: bool | None = None) -> Iterator[Data]:

if self.get_in_progress:
raise ConcurrencyError("get() or get_iter() is already running")

# Locking with get_in_progress ensures only one coroutine can get here.
self.get_in_progress = True

# Locking with get_in_progress prevents concurrent execution until
# get_iter() fetches a complete message or is cancelled.
# Locking with get_in_progress prevents concurrent execution
# until get_iter() fetches a complete message or times out.

# If get_iter() raises an exception e.g. in decoder.decode(),
# get_in_progress remains set and the connection becomes unusable.
Expand Down

0 comments on commit bdfc8cf

Please sign in to comment.