From 89c3989f58c2c0458fc0dc5848b9ba483a9db91e Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Mon, 22 Apr 2019 13:58:36 +0200 Subject: Catch socket errors when sending ping Also check that the team is connected before sending ping. Fixes #687 --- wee_slack.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'wee_slack.py') 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 -- cgit