Skip to content

Commit

Permalink
Fixed race condition with on_open and session.close()
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjoes committed Feb 3, 2012
1 parent 04705be commit 9b9d4a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tornadio2/session.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ def __init__(self, conn, server, request, expiry=None):
# If everything is fine - continue # If everything is fine - continue
self.send_message(proto.connect()) self.send_message(proto.connect())


result = self.conn.on_open(info)
if result is not None and not result:
raise HTTPError(401)

# Heartbeat related stuff # Heartbeat related stuff
self._heartbeat_timer = None self._heartbeat_timer = None
self._heartbeat_interval = self.server.settings['heartbeat_interval'] * 1000 self._heartbeat_interval = self.server.settings['heartbeat_interval'] * 1000
Expand All @@ -119,6 +115,10 @@ def __init__(self, conn, server, request, expiry=None):
# Endpoints # Endpoints
self.endpoints = dict() self.endpoints = dict()


result = self.conn.on_open(info)
if result is not None and not result:
raise HTTPError(401)

# Session callbacks # Session callbacks
def on_delete(self, forced): def on_delete(self, forced):
"""Session expiration callback """Session expiration callback
Expand Down

0 comments on commit 9b9d4a4

Please sign in to comment.