jquast / telnetlib3

Python Telnet server and client Protocol library using asyncio
Other
144 stars 32 forks source link

When clients disconnect protocol objects remain on the server side #43

Closed fried closed 4 years ago

fried commented 4 years ago

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

jquast commented 4 years ago

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.