New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client abandon logic and debug #17
Conversation
@@ -208,10 +207,14 @@ def unhandled_error(self, error): | |||
# ws4py calls this with any socket errors | |||
# Doesn't matter what the socket error is; connection is fubar. | |||
log.error('error in WSApp: %s', error) | |||
# Can't terminate here | |||
# Trick the server in to exiting | |||
self.server_terminated = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't call terminate. It doesn't look like that was intended to be a part of the public interface.
There is a close
method, which attempts to send a websocket close frame. That wont work if the connection it fubar.
The server_terminated
boolean exists the main loop. Its undocumented, a bit shitty, but it seems the only way to avoid tracebacks.
@@ -310,6 +313,16 @@ def connect(self, wait=True, timeout=None): | |||
return self.wait_ready(timeout=timeout) | |||
return None | |||
|
|||
def abandon(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reset everything so this object won't process any packets nor block. To fix suspected thread not closing.
@@ -118,27 +127,35 @@ def run(self): | |||
|
|||
while 1: | |||
# Get the identity, and tell the server about it | |||
log.debug('1') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgive these debug lines for now. I'll keep them in until we're more confident in the logic.
self.manager.on_client_close() | ||
|
||
def abandon(self): | ||
self._manager = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Un-bind the manager, so there is no chance of some method being called from a hook from a dying thread.
What this PR solves
How it is done
What to look out for
Screenshots (if appropriate)
Review