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

Glyph Lefkowitz glyph at twistedmatrix.com
Sat Jan 9 15:14:37 MST 2016


> On Jan 9, 2016, at 1:56 PM, Sirenfal <avosirenfal at gmail.com> wrote:
> 
> 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 <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?
>  

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20160109/f2743aef/attachment-0002.html>


More information about the Twisted-Python mailing list