close_stream_writer

async lsst.ts.tcpip.close_stream_writer(writer: StreamWriter) None

Close an asyncio.StreamWriter and wait for it to finish closing.

Safe to call if the stream is closed or being closed, though in the latter case this function may raise asyncio.CancelledError.

This function swallows ConnectionError, because that means the stream writer is closed.

Parameters:
writerasyncio.StreamWriter

Asynchronous stream writer to close.

Raises:
asyncio.CancelledError

If the writer is already being closed. I am not sure if this is expected behavior or a bug in Python.