diff options
author | Cameron Matheson <cameron.matheson@gmail.com> | 2017-07-05 23:02:41 -0600 |
---|---|---|
committer | Cameron Matheson <cameron.matheson@gmail.com> | 2017-07-05 23:03:41 -0600 |
commit | e32e861cbf4ed967cfa4fda0208dd42af0902d75 (patch) | |
tree | 9bf9668fefa3115bcda611b69a390c472480a2f9 | |
parent | 7bf0ea6a4eedc0c98152b3b13f1394676a39d4dd (diff) | |
download | wee-slack-e32e861cbf4ed967cfa4fda0208dd42af0902d75.tar.gz |
Stop polling dead websockets. Fixes #349
-rw-r--r-- | wee_slack.py | 3 |
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): |