Skip to content

connection _close_message_queue() implementation #11

@belm0

Description

@belm0

I had a chance to review the code briefly, looks very good. One thing standing out as a little odd was the _close_message_queue() implementation:

https://github.com/HyperionGray/trio-websocket/blob/b787bf1a8a026ef1d9ca995d044bc97d42e7f727/trio_websocket/__init__.py#L204-L209

Possible issues:

  • if put_nowait() was successful on the first iteration, tasks waiting on the queue will certainly receive the exception object. So I can't see a reason for having the while loop which puts yet more exceptions in the queue.
  • if put_nowait() fails on the first iteration, it means an unreceived message is already pending, and the while loop is exited. But in that case the tasks will not receive the close exception-- is that OK?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions