aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorCameron Matheson <cameron.matheson@gmail.com>2017-07-05 23:02:41 -0600
committerCameron Matheson <cameron.matheson@gmail.com>2017-07-05 23:03:41 -0600
commite32e861cbf4ed967cfa4fda0208dd42af0902d75 (patch)
tree9bf9668fefa3115bcda611b69a390c472480a2f9 /wee_slack.py
parent7bf0ea6a4eedc0c98152b3b13f1394676a39d4dd (diff)
downloadwee-slack-e32e861cbf4ed967cfa4fda0208dd42af0902d75.tar.gz
Stop polling dead websockets. Fixes #349
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 7ba1995..341cb5e 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1024,7 +1024,7 @@ class SlackTeam(object):
if self.ws_url:
try:
ws = create_connection(self.ws_url, sslopt=sslopt_ca_certs)
- w.hook_fd(ws.sock._sock.fileno(), 1, 0, 0, "receive_ws_callback", self.get_team_hash())
+ self.hook = w.hook_fd(ws.sock._sock.fileno(), 1, 0, 0, "receive_ws_callback", self.get_team_hash())
ws.sock.setblocking(0)
self.ws = ws
# self.attach_websocket(ws)
@@ -1048,6 +1048,7 @@ class SlackTeam(object):
self.connected = True
def set_disconnected(self):
+ w.unhook(self.hook)
self.connected = False
def set_reconnect_url(self, url):