`QuicStreamAdapter` should implement more methods of `BaseTransport`
lotabout opened this issue · comments
TLDR: At least need to implement:
is_closing
close
Long Story
It seems that StreamWriter
returned by QuicConnectionProtocol#create_stream
will cause error when GC-ed.
Here is the minimal example:
import asyncio
from aioquic.asyncio import QuicConnectionProtocol
async def tmp():
proto = QuicConnectionProtocol(None)
reader, writer = proto._create_stream(123)
del writer
asyncio.run(tmp())
The following exception occurred:
Exception ignored in: <function StreamWriter.__del__ at 0x1034b5e40>
Traceback (most recent call last):
File ".../python3.11/asyncio/streams.py", line 395, in __del__
if not self._transport.is_closing():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../python3.11/asyncio/transports.py", line 25, in is_closing
raise NotImplementedError
NotImplementedError:
It is called in StreamWriter#__del__
:
class StreamWriter:
...
def close(self):
return self._transport.close()
def __del__(self):
if not self._transport.is_closing():
self.close()
As noted in #169 i am not happy with the API, and am still considering dropping it in version 1.0
Understand. :)