jquast / telnetlib3

Python Telnet server and client Protocol library using asyncio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When clients disconnect protocol objects remain on the server side

fried opened this issue · comments

circular references.

The protocol references the transport which references the protocol.
The stream_writer has a bunch of references to the protocol which references the stream_writer
the stream_reader has a reference to the protocol which references the stream_reader.

I used weakref.finalize to print when the writer or the protocol get deleted and they don't get deleted until python is shutdown.

    weakref.finalize(writer, print, "writer was deleted.")
    weakref.finalize(writer._protocol, print, "protocol deleted.")

Let me organize my changes into a pull request for a fix

Thanks!! PR was merged, and, I added similar weakref.proxy() wrapper to the Client as well. I will release 1.0.3 to pypi shortly.