diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2019-04-22 13:58:36 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-04-23 10:56:41 +0200 |
commit | 89c3989f58c2c0458fc0dc5848b9ba483a9db91e (patch) | |
tree | b4b8a22effb46f651e91dcdbcbb11a0ca2883929 /wee_slack.py | |
parent | 8aebe4b883a97b64357b6218ee89aa098ca2dcae (diff) | |
download | wee-slack-89c3989f58c2c0458fc0dc5848b9ba483a9db91e.tar.gz |
Catch socket errors when sending ping
Also check that the team is connected before sending ping.
Fixes #687
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/wee_slack.py b/wee_slack.py index 9839cf9..164948c 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -710,8 +710,11 @@ def receive_ws_callback(*args): @utf8_decode def ws_ping_cb(data, remaining_calls): for team in EVENTROUTER.teams.values(): - if team.ws: - team.ws.ping() + if team.ws and team.connected: + try: + team.ws.ping() + except (WebSocketConnectionClosedException, socket.error) as e: + handle_socket_error(e, team, 'ping') return w.WEECHAT_RC_OK |