tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Turk <mt...@apache.org>
Subject Re: APR/native and per socket timeouts.
Date Sun, 20 May 2012 20:47:12 GMT
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'


Regards
-- 
^TM

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


Mime
View raw message