Skip to content

Commit

Permalink
Merge pull request #201 from steowens/master
Browse files Browse the repository at this point in the history
This change is to address the issue with run_forever() terminating too early.
  • Loading branch information
Lawouach committed Dec 12, 2016
2 parents fd55907 + 608d648 commit 657ca45
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ws4py/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,16 +404,15 @@ def terminate(self):
good and cleanup resources by unsetting
the `environ` and `stream` attributes.
"""
s = self.stream

self.client_terminated = self.server_terminated = True
s = self.stream

try:
if s.closing is None:
self.closed(1006, "Going away")
else:
self.closed(s.closing.code, s.closing.reason)
finally:
self.client_terminated = self.server_terminated = True
self.close_connection()

# Cleaning up resources
Expand Down

0 comments on commit 657ca45

Please sign in to comment.