Skip to content
This repository was archived by the owner on Feb 27, 2025. It is now read-only.

Commit

Permalink
Don't start heartbeat until _writer is set (aio-libs#4062) (aio-libs#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Peterson authored and frederikaalund committed Nov 26, 2019
1 parent 7981b18 commit 1468761
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/4062.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't start heartbeat until _writer is set
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Elizabeth Leddy
Enrique Saez
Eric Sheng
Erich Healy
Erik Peterson
Eugene Chernyshov
Eugene Naydenov
Eugene Nikolaiev
Expand Down
5 changes: 3 additions & 2 deletions aiohttp/web_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@ def _pre_start(self, request: BaseRequest) -> Tuple[str, WebSocketWriter]:
headers, protocol, compress, notakeover = self._handshake(
request)

self._reset_heartbeat()

self.set_status(101)
self.headers.update(headers)
self.force_close()
Expand All @@ -224,6 +222,9 @@ def _post_start(self, request: BaseRequest,
protocol: str, writer: WebSocketWriter) -> None:
self._ws_protocol = protocol
self._writer = writer

self._reset_heartbeat()

loop = self._loop
assert loop is not None
self._reader = FlowControlDataQueue(
Expand Down

0 comments on commit 1468761

Please sign in to comment.