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.
dispatcher <function dispatcher at 0x00FD57B0> template <function deliverBody at
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
dispatcher <function dispatcher at 0x00FD9170> template <function connectionLost
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.