tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: APR/native and per socket timeouts.
Date Mon, 21 May 2012 12:55:13 GMT
On 20/05/2012 21:47, Mladen Turk wrote:
> On 05/20/2012 08:37 PM, Mark Thomas wrote:
>> Therefore, I intend modifying the APR/native code to support per socket
>> time outs. I would be grateful if those of you with more C knowledge
>> than I (which is most people on this list) could:
>> a) tell me now if this is a crazy idea (and why)
>> b) keep an extra close eye on any commit of mine that touches the C code.
>>
> 
> This should be easy to implement.
> Inside native we track socket_ttl for each socket.
> Currently when  socket is added it's set to apr_time_now()
> and later compared with max_ttl (usually keepAliveTimeout).
> 
> We can add new API that would add socket with timeout relative
> to max_ttl. A bit awkward but wouldn't create backward incompatibility.
> 
> Take a look at poll.c add function.
> The new addt would have additional timeout parameter and
> you would set:
> ...
> if (p->max_ttl > 0)
>         p->socket_ttl[p->nelts] = apr_time_now() + J2T(timeout);
> ...
> 
> Now that new timeout param would actually be called as
> Poll.add(pollset, socket, events, perSocketPollTimeout - keepAliveTimeout);
> given that keepAliveTimeout was used for Poll.setTtl(keepAliveTimeout);
> 
> So effectively socket_ttl would become 'now() - ttlOffset'

Thanks for confirming I am heading in the right direction with this. I'm
hesitant to follow exactly the path above. While it is a minimal change
from the current code, I think it could be difficult for folks new to
the code to figure out what is going on.

I'd like to see if I can come up with a change that will be more obvious
on first reading. I expect it will be a little more invasive than the
change you suggested. Depending on my level of confidence, I'll either
post a patch or commit the change when I have something concrete.

Cheers,

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message