<br><br><div class="gmail_quote">On Sat, Jan 14, 2012 at 3:01 PM,  <span dir="ltr">&lt;<a href="mailto:exarkun@twistedmatrix.com">exarkun@twistedmatrix.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 10:18 am, <a href="mailto:johnaherne@rocs.co.uk">johnaherne@rocs.co.uk</a> wrote:<br>
&gt;I have a situation where a service I am using will occasionally not<br>
&gt;respond<br>
&gt;for considerable periods - hours not minutes.<br>
&gt;<br>
&gt;I am using cooperate and yield to loop round a series of requests I<br>
&gt;want to<br>
&gt;make<br>
&gt;<br>
&gt;The actual function to send the request returns a deferred to the<br>
&gt;yield. I<br>
&gt;add the callbacks onto this and set a calllater to fire in 30 seconds.<br>
&gt;<br>
&gt;If that fires I can then cancel the deferred. But I think I ought to be<br>
&gt;cancelling the request as well else I assume I will be leaking request<br>
&gt;objects that might not get dealt with.<br>
&gt;<br>
&gt;However, I can&#39;t see where I might cancel the request. Or should I be<br>
&gt;dropping the connection associated with the request and if so where<br>
&gt;would I<br>
&gt;be doing that.<br>
&gt;<br>
&gt;Have I got that right?<br>
<br>
</div></div>The cancel method of the Deferred returned by Agent.request is probably<br>
the right API to use to do the cleanup you&#39;re interested in.  However,<br>
cancelation is not specifically implemented for the Agent.request<br>
Deferred yet.  Though it may sound like one, this is not a contradiction<br>
due to the way Deferred cancelation works (ideally we would have<br>
documentation about Deferred cancelation that would explain why this is,<br>
but we don&#39;t).<br>
<br>
See <a href="http://twistedmatrix.com/trac/ticket/4330" target="_blank">http://twistedmatrix.com/trac/ticket/4330</a> for progress on this issue<br>
or to contribute.<br>
<br>
Jean-Paul<br>
<br>
_______________________________________________<br>
Twisted-web mailing list<br>
<a href="mailto:Twisted-web@twistedmatrix.com">Twisted-web@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web</a><br>
</blockquote></div>Thanks for the information.<div><br></div><div>I did take a look at the ticket. Not sure what I could contribute though. But will take a closer look.</div><div><br></div><div>John Aherne</div>