Skip to content

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

Description

@vzarutskiy

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions