mirror of https://github.com/huashengdun/webssh
Use JSONDecodeError
parent
a893507946
commit
96d9ae5b4d
|
@ -18,6 +18,11 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from tornado.concurrent import Future
|
from tornado.concurrent import Future
|
||||||
|
|
||||||
|
try:
|
||||||
|
from json.decoder import JSONDecodeError
|
||||||
|
except ImportError:
|
||||||
|
JSONDecodeError = ValueError
|
||||||
|
|
||||||
|
|
||||||
DELAY = 3
|
DELAY = 3
|
||||||
|
|
||||||
|
@ -204,9 +209,7 @@ class WsockHandler(MixinHandler, tornado.websocket.WebSocketHandler):
|
||||||
worker = self.worker_ref()
|
worker = self.worker_ref()
|
||||||
try:
|
try:
|
||||||
msg = json.loads(message)
|
msg = json.loads(message)
|
||||||
except ValueError: # py2
|
except JSONDecodeError:
|
||||||
return
|
|
||||||
except json.decoder.JSONDecodeError: # py3
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if not isinstance(msg, dict):
|
if not isinstance(msg, dict):
|
||||||
|
|
Loading…
Reference in New Issue