Skip to content

Commit

Permalink
close rather than send request_leave
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Apr 12, 2017
1 parent ceae40b commit 414f5ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion m2mclient/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from __future__ import unicode_literals

VERSION = "0.1.6"
VERSION = "0.1.7a"
8 changes: 2 additions & 6 deletions m2mclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,8 @@ def __enter__(self):

def __exit__(self, exc_type, exc_val, exc_tb):
try:
# Ask politely to leave
# Close the websocket
self.close()
# Wait until we're done
if not self.ws.join(1):
# Force a close if we didn't complete
self.ws.close()
finally:
self.ws = None
self.dispatcher.close()
Expand Down Expand Up @@ -193,7 +189,7 @@ def close(self):
"""A graceful close."""
# If everything is working, the server will kick us in a few
# milliseconds.
self.send('request_leave')
self.ws.close()

def send(self, packet_type, *args, **kwargs):
"""Send a packet."""
Expand Down

0 comments on commit 414f5ef

Please sign in to comment.