tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Turk <mt...@apache.org>
Subject Re: svn commit: r660175 - in /tomcat/connectors/trunk/jni: CHANGELOG.txt native/src/poll.c
Date Mon, 26 May 2008 13:55:26 GMT
Remy Maucherat wrote:
>> +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).
> 

It's because poll returns socket descriptor array not our internal data,
so we need to match the socket to our socket placeholder.
Not very efficient, I know.
The solution would be to add additional array to the internal
struct that would allow to skip this scan.
I'll see how this can be done more intelligently.


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