8000 Possible Avast fix. · pythonanywhere/tornadio2@249a33c · GitHub
[go: up one dir, main page]

Skip to content

Commit 249a33c

Browse files
committed
Possible Avast fix.
1 parent ccafb90 commit 249a33c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tornadio2/persistent.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ def open(self, session_id):
4949
if self.session is None:
5050
raise tornado.HTTPError(401, "Invalid Session")
5151

52-
# Associate session handler
53-
self.session.set_handler(self)
54-
self.session.reset_heartbeat()
55-
5652
if not self._is_active:
5753
# Need to check if websocket connection was really established by sending hearbeat packet
5854
# and waiting for response
5955
self.write_message(proto.heartbeat())
6056
self.server.io_loop.add_timeout(time.time() + 5, self._connection_check)
6157
else:
58+
# Associate session handler
59+
self.session.set_handler(self)
60+
self.session.reset_heartbeat()
61+
6262
# Flush messages, if any
6363
self.session.flush()
6464

@@ -85,7 +85,11 @@ def on_message(self, message):
8585

8686
# Mark that connection is active and flush any pending messages
8787
if not self._is_active:
88+
# Associate session handler and flush queued messages
89+
self.session.set_handler(self)
90+
self.session.reset_heartbeat()
8891
self.session.flush()
92+
8993
self._is_active = True
9094

9195
try:

0 commit comments

Comments
 (0)
0