Skip to content

AsyncIoStream method wait_closed() raises attribute error #365

Open
@mwilliamson-fourier

Description

@mwilliamson-fourier

When using AsyncIoStream, I've tried to use wait_closed() after closing the connection. However, doing so results in an error since it seems like a non-existent attribute is being referenced:

  File "/tmp/a/capnp-async-connection.py", line 12, in main
    await connection.wait_closed()
  File "capnp/lib/capnp.pyx", line 2414, in wait_closed
AttributeError: 'capnp.lib.capnp._PyAsyncIoStreamProtocol' object has no attribute 'closed_future'

The below should be a fairly minimal reproduction of the issue, assuming there's a server running on the relevant hostname and port:

import asyncio

import capnp

async def main():
    async with capnp.kj_loop():
        connection = await capnp.AsyncIoStream.create_connection(
            host="127.0.0.1",
            port=8000,
        )

        connection.close()
        await connection.wait_closed()


asyncio.run(main())

Am I using wait_closed() incorrectly, or is this a bug in pycapnp?

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