Skip to content

Commit

Permalink
Don't start heartbeat until _writer is set (#4062) (#4323)
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Peterson authored and asvetlov committed Oct 16, 2020
1 parent 59d0f2e commit aa3895a
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 @@ -93,6 +93,7 @@ Emil Melnikov
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 @@ -209,8 +209,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 @@ -228,6 +226,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 aa3895a

Please sign in to comment.