[Twisted-Python] How to disconnect an HTTP connection and notify the far end

Bob Novas bob.novas at shinkuro.com
Wed Sep 18 14:59:38 MDT 2013


I've got a question on how to explicitly disconnect a connection from the
client side so that the server side knows that the connection has been
disconnected. I'd be happy if this worked even with no guarantees, i.e.,
only when the client and server were in fact well-connected. It's just an
optimization to allow the server to cleanup.

 

I've got an HTTP client that uses HTTPConnectionPool to get an Agent, gets a
Request from the Agent, and sends the Request to a WebServer on a linux box.


 

On a Mac client, if I call closeCachedConnections() on the
HTTPConnectionPool, the client immediately sends FIN on the port with the
Request outstanding, the server delivers a callback registered on the
Request via NotifyFinish() and the server knows the client has disconnected.

 

On a Windows client, if I do the same, same code, the client waits until the
outstanding Request finishes and then sends FIN. Nothing happens at the
server - there's no Request outstanding on which to deliver a callback,
twisted.internet.tcp.Port.connectionLost() doesn't get called, nada.

 

Am I missing something?  Is there a way to send a FIN on a connection on
which there is an outstanding Request on Windows?

 

Thanks in advance,

Bob

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20130918/152633fb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6085 bytes
Desc: not available
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20130918/152633fb/attachment.bin>


More information about the Twisted-Python mailing list