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

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.

Sorry, I meant to say "get the Protocol disposed in the main process" in the first sentence :)

Since you also asked on Stack Overflow I answered there: http://stackoverflow.com/a/34699544/13564

Sorry, I meant to say "get the Protocol disposed in the main process" in the first sentence :)

Since you also asked on Stack Overflow I answered there: http://stackoverflow.com/a/34699544/13564
participants (2)
-
Glyph Lefkowitz
-
Sirenfal