[Twisted-Python] Trying to use adoptStreamConnection and Protocol isn't being disposed

Sirenfal avosirenfal at gmail.com
Sat Jan 9 14:56:00 MST 2016


I'm trying to pass a TCP connection to a Twisted subprocess with 
adoptStreamConnection, but I can't figure out how to get the Process 
disposed in the main process after doing that.

My desired flow looks like this:

- Finish writing any data the Protocol transport has waiting
- When we know the write buffer is empty send the AMP message to 
transfer the socket to the subprocess
- Dispose the Protocol instance in the main process
- I tried doing nothing, loseConnection, abortConnection, and monkey 
patching _socketClose out and using loseConnection. See code here: 
http://pastebin.com/nK0Huxuj

In all cases the Protocol object still exists in the main process after 
the socket has been transferred, even if the main process isn't 
listening to that socket anymore. How can I clean this up?

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20160109/3bdd0631/attachment.html>


More information about the Twisted-Python mailing list