Skip to content

Cannot pause asyncio transport immediately #103607

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

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

    stdlibStandard Library Python modules in the Lib/ directorytopic-asynciotype-bugAn unexpected behavior, bug, or error

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions