Skip to content

Cannot pause asyncio transport immediately #103607

Closed
@LasseBlaauwbroek

Description

@LasseBlaauwbroek

Bug report

When creating a asyncio transport/protocol pair, one might want to call transport.pause_reading() immediately when protocol.connection_made() is called. This is currently not possible. The call to pause_reading() is ignored, and reading commences nonetheless.

This is problematic, because there is no other place where the transport can be immediately paused, especially when the protocol is created through loop.create_server.

As a remedy, I would suggest guarding

self._loop.call_soon(self._add_reader,
self._sock_fd, self._read_ready)

with if not self._paused:. There might be other places where this is needed, for other event loops.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtopic-asynciotype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions