aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Huber <rhuber@gmail.com>2015-11-18 03:37:27 +0000
committerRyan Huber <rhuber@gmail.com>2015-11-18 03:37:27 +0000
commit84bd1bfa45670079ff63f675d4b4a7df72e1b393 (patch)
tree446a23d85df170b0e0ff5948dd5fcda2291906f2
parentdf15f2f4973059008dc816f78df939d18826b699 (diff)
downloadwee-slack-84bd1bfa45670079ff63f675d4b4a7df72e1b393.tar.gz
close websocket to prevent race + fix broken comparison
-rw-r--r--wee_slack.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index e4edc2c..d50c279 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -222,7 +222,7 @@ class SlackServer(object):
w.unhook(self.ping_hook)
self.communication_counter = 0
self.ping_hook = w.hook_timer(1000 * 5, 0, 0, "slack_ping_cb", self.domain)
- if len(self.users) and 0 or len(self.channels) == 0:
+ if len(self.users) == 0 or len(self.channels) == 0:
self.create_slack_mappings(login_data)
self.connected = True
@@ -1190,6 +1190,7 @@ def slack_websocket_cb(server, fd):
# this magic attaches json that helps find the right dest
message_json['_server'] = server
except:
+ servers.find(server).ws.close()
return w.WEECHAT_RC_OK
# dispatch here
if "reply_to" in message_json: