Skip to content
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

Finishing of handle() after disconnect_clients_abruptly() leads to executing _client_left_ with None #118

Open
vzarutskiy opened this issue Mar 22, 2023 · 0 comments

Comments

@vzarutskiy
Copy link

After executing disconnect_clients_abruptly() self.clients list is cleared.

    def _client_left_(self, handler):
        client = self.handler_to_client(handler)
        self.client_left(client, self)
        if client in self.clients:
            self.clients.remove(client)

Sometimes handle() function finished after this in point self.read_next_message():

    def handle(self):
        while self.keep_alive:
            if not self.handshake_done:
                self.handshake()
            elif self.valid_client:
                self.read_next_message()

It lead to execute finish() function with None client.
Because handler_to_client() does not find client in self.client list:

    def handler_to_client(self, handler):
        for client in self.clients:
            if client['handler'] == handler:
                return client
@vzarutskiy vzarutskiy changed the title Finishing of handle() after disconnect_clients_abruptly() lead to executing _client_left_ with None Finishing of handle() after disconnect_clients_abruptly() leads to executing _client_left_ with None Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant