tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remy Maucherat <r...@apache.org>
Subject Re: svn commit: r660175 - in /tomcat/connectors/trunk/jni: CHANGELOG.txt native/src/poll.c
Date Mon, 26 May 2008 13:29:39 GMT
On Mon, 2008-05-26 at 12:42 +0000, mturk@apache.org wrote:
> Author: mturk
> Date: Mon May 26 05:42:11 2008
> New Revision: 660175
> 
> URL: http://svn.apache.org/viewvc?rev=660175&view=rev
> Log:
> Fix 45071 by updating ttl for signaled but not removed sockets

> +static void update_ttl(tcn_pollset_t *p, const apr_pollfd_t *fd, apr_time_t t)
> +{
> +    apr_int32_t i;
> +
> +    for (i = 0; i < p->nelts; i++) {
> +        if (fd->desc.s == p->socket_set[i].desc.s) {
> +            /* Found an instance of the fd: update ttl */
> +            p->socket_ttl[i] = t;
> +            break;
> +        }
> +    }
> +}

Why is it needed to iterate over the whole array rather than simply for
the array position that is signaled ? I am not aware of cases where one
socket is placed multiple times in the poller (actually, this would
probably cause crashes when the socket is closed).

Of course, compared with the IO operation itself, this is still quite
cheap.

Rémy



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


Mime
View raw message