http: Guard against double close of WebSocket
This commit is contained in:
parent
f1096d332c
commit
83e779eaaf
@ -32,6 +32,9 @@ Bug fix release.
|
|||||||
constant for use by implementors of :method:`mopidy.local.Library.browse`.
|
constant for use by implementors of :method:`mopidy.local.Library.browse`.
|
||||||
(Related to: :issue:`833`)
|
(Related to: :issue:`833`)
|
||||||
|
|
||||||
|
- HTTP frontend: Guard against double close of WebSocket, which causes an
|
||||||
|
:exc:`AttributeError` on Tornado < 3.2.
|
||||||
|
|
||||||
|
|
||||||
v0.19.3 (2014-08-03)
|
v0.19.3 (2014-08-03)
|
||||||
====================
|
====================
|
||||||
|
|||||||
@ -110,7 +110,10 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler):
|
|||||||
self.request.remote_ip, response)
|
self.request.remote_ip, response)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('WebSocket request error: %s', e)
|
logger.error('WebSocket request error: %s', e)
|
||||||
self.close()
|
if self.ws_connection:
|
||||||
|
# Tornado 3.2+ checks if self.ws_connection is None before
|
||||||
|
# using it, but not older versions.
|
||||||
|
self.close()
|
||||||
|
|
||||||
def check_origin(self, origin):
|
def check_origin(self, origin):
|
||||||
# Allow cross-origin WebSocket connections, like Tornado before 4.0
|
# Allow cross-origin WebSocket connections, like Tornado before 4.0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user