Skip to content

Commit

Permalink
Fixed bug with WebSocket/FlashSocket transport initialization, in cas…
Browse files Browse the repository at this point in the history
…e of

malformed/unsupported WebSocket handshake.
  • Loading branch information
mrjoes committed Jun 8, 2011
1 parent c69bd11 commit 80070fa
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tornadio/persistent.py
Expand Up @@ -22,6 +22,7 @@ def __init__(self, router, session_id):
logging.debug('Initializing WebSocket handler...')

self.router = router
self.connection = None

super(TornadioWebSocketHandler, self).__init__(router.application,
router.request)
Expand Down Expand Up @@ -80,11 +81,12 @@ def on_message(self, message):
self.async_callback(self.connection.raw_message)(message)

def on_close(self):
try:
self.connection.on_close()
finally:
self.connection.is_closed = True
self.connection.stop_heartbeat()
if self.connection is not None:
try:
self.connection.on_close()
finally:
self.connection.is_closed = True
self.connection.stop_heartbeat()

def send(self, message):
self.write_message(proto.encode(message))
Expand Down

0 comments on commit 80070fa

Please sign in to comment.