[Mod]catch socket.error in WebsocketClient
This commit is contained in:
parent
a6f17d7d66
commit
2bce3fcf67
@ -4,6 +4,7 @@ import json
|
|||||||
import ssl
|
import ssl
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
import socket
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from threading import Lock, Thread
|
from threading import Lock, Thread
|
||||||
from time import sleep
|
from time import sleep
|
||||||
@ -184,7 +185,8 @@ class WebsocketClient(object):
|
|||||||
|
|
||||||
self.on_packet(data)
|
self.on_packet(data)
|
||||||
# ws is closed before recv function is called
|
# ws is closed before recv function is called
|
||||||
except websocket.WebSocketConnectionClosedException:
|
# For socket.error, see Issue #1608
|
||||||
|
except (websocket.WebSocketConnectionClosedException, socket.error):
|
||||||
self._reconnect()
|
self._reconnect()
|
||||||
|
|
||||||
# other internal exception raised in on_packet
|
# other internal exception raised in on_packet
|
||||||
|
Loading…
Reference in New Issue
Block a user