So far this is where I have got to.
In my timeout using callLater, I call d._canceller().
This calls _connectionLost_WAITING which is partly what I would expect. But it does not call _canceller_WAITING which I would have expected as well.
The function at d._canceller would appear to be cancelConnection so I can see why it would go to loseConnection right away. But I have not found where cancelConnection resides yet.
The _connectLost_WAITING then calls disconnectParser and finally does the errback with ResponseFailed and the connection is dropped cleanly.
The fact that _canceller_WAITING is not called makes me think I am making the wrong call on the request deferred when I use d._canceller(), but I have not seen anything else I can call.
Also d._canceller requires a parameter. And I can pass it anything and it seems to not make use of any argument I pass in. I have used d the deferred, None, 'TRANSMITTING' the string all with exactly the same effect.
So it makes me think I am making the wrong call on the request deferred.
Does anyone know if I should be calling some other function.
Below is the result from a test run outputting various points the program runs through which might be helpful.
E:\jahtest>test_post.py dispatcher <function dispatcher at 0x00FD57B0> template <function deliverBody at 0x00FD5770> dispatcher <function dispatcher at 0x00FD58F0> template <function _bodyDataRecei ved at 0x00FD58B0> dispatcher <function dispatcher at 0x00FD5A30> template <function _bodyDataFinis hed at 0x00FD59F0> dispatcher <function dispatcher at 0x00FD5F70> template <function _canceller at 0x00FD5F30> dispatcher <function dispatcher at 0x00FD9170> template <function connectionLost at 0x00FD9130> body <stringprod_resp.StringProducer object at 0x00F9BCB0> fff canceller <function cancelConnect at 0x00FD95B0> got do cancel connectionlost waiting [Failure instance: Traceback (failure with no frames): <c lass 'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly. ] disconnect parser [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly. ] got error <bound method Failure.getErrorMessage of <twisted.python.failure.Failu re <class 'twisted.web._newclient.ResponseFailed'>>>
Thanks for any info.
John Aherne
On Thu, Jul 7, 2011 at 9:31 AM, John Aherne johnaherne@rocs.co.uk wrote:
The fact that _canceller_WAITING is not called makes me think I am making the wrong call on the request deferred when I use d._canceller(), but I have not seen anything else I can call.
I'll admit to not knowing exactly what you're doing, but shouldn't you be calling d.cancel() not d._canceller() ?
On Thu, Jul 7, 2011 at 10:44 AM, Tristan Seligmann mithrandi@mithrandi.netwrote:
On Thu, Jul 7, 2011 at 9:31 AM, John Aherne johnaherne@rocs.co.uk wrote:
The fact that _canceller_WAITING is not called makes me think I am making the wrong call on the request deferred when I use d._canceller(), but I
have
not seen anything else I can call.
I'll admit to not knowing exactly what you're doing, but shouldn't you be calling d.cancel() not d._canceller() ?
You are correct of course. I started off using cancel() but was getting already called errors. So I started looking around to see what was going on and tried to trace through the various functions being called. That's how I ended up playing around with _canceller.
What I did not do was find out what was really causing the already called errors.
Which now you have prompted me I have sorted out. Typically something silly - like overriding the callLater functions.
So sorry for all the noise over _canceller.
Thanks
John Aherne