Author: markt Date: Wed May 23 20:06:26 2012 New Revision: 1342008 URL: http://svn.apache.org/viewvc?rev=1342008&view=rev Log: Renames to make code clearer socket_ttl -> socket_last_active max_ttl -> default_timeout
Modified: tomcat/native/trunk/native/src/poll.c Modified: tomcat/native/trunk/native/src/poll.c URL: http://svn.apache.org/viewvc/tomcat/native/trunk/native/src/poll.c?rev=1342008&r1=1342007&r2=1342008&view=diff ============================================================================== --- tomcat/native/trunk/native/src/poll.c (original) +++ tomcat/native/trunk/native/src/poll.c Wed May 23 20:06:26 2012 @@ -40,8 +40,8 @@ typedef struct tcn_pollset { apr_pollset_t *pollset; jlong *set; apr_pollfd_t *socket_set; - apr_time_t *socket_ttl; - apr_interval_time_t max_ttl; + apr_time_t *socket_last_active; + apr_interval_time_t default_timeout; jboolean wakeable; #ifdef TCN_DO_STATISTICS int sp_added; @@ -166,12 +166,12 @@ TCN_IMPLEMENT_CALL(jlong, Poll, create)( TCN_CHECK_ALLOCATED(tps->set); tps->socket_set = apr_palloc(p, size * sizeof(apr_pollfd_t)); TCN_CHECK_ALLOCATED(tps->socket_set); - tps->socket_ttl = apr_palloc(p, size * sizeof(apr_interval_time_t)); - TCN_CHECK_ALLOCATED(tps->socket_ttl); + tps->socket_last_active = apr_palloc(p, size * sizeof(apr_interval_time_t)); + TCN_CHECK_ALLOCATED(tps->socket_last_active); tps->nelts = 0; tps->nalloc = size; tps->pool = p; - tps->max_ttl = J2T(ttl); + tps->default_timeout = J2T(ttl); #if defined(APR_POLLSET_WAKEABLE) if (f & APR_POLLSET_WAKEABLE) tps->wakeable = JNI_TRUE; @@ -223,10 +223,10 @@ TCN_IMPLEMENT_CALL(jint, Poll, add)(TCN_ fd.reqevents = (apr_int16_t)reqevents; fd.desc.s = s->sock; fd.client_data = s; - if (p->max_ttl > 0) - p->socket_ttl[p->nelts] = apr_time_now(); + if (p->default_timeout > 0) + p->socket_last_active[p->nelts] = apr_time_now(); else - p->socket_ttl[p->nelts] = 0; + p->socket_last_active[p->nelts] = 0; p->socket_set[p->nelts] = fd; p->nelts++; @@ -259,7 +259,7 @@ static apr_status_t do_remove(tcn_pollse } else { p->socket_set[dst] = p->socket_set[i]; - p->socket_ttl[dst] = p->socket_ttl[i]; + p->socket_last_active[dst] = p->socket_last_active[i]; dst++; } } @@ -269,14 +269,14 @@ static apr_status_t do_remove(tcn_pollse return apr_pollset_remove(p->pollset, fd); } -static void update_ttl(tcn_pollset_t *p, const apr_pollfd_t *fd, apr_time_t t) +static void update_last_active(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; + /* Found an instance of the fd: update last active time */ + p->socket_last_active[i] = t; break; } } @@ -334,18 +334,18 @@ TCN_IMPLEMENT_CALL(jint, Poll, poll)(TCN p->sp_poll++; #endif - if (ptime > 0 && p->max_ttl >= 0) { + if (ptime > 0 && p->default_timeout >= 0) { now = apr_time_now(); /* Find the minimum timeout */ for (i = 0; i < p->nelts; i++) { - apr_interval_time_t t = now - p->socket_ttl[i]; - if (t >= p->max_ttl) { + apr_interval_time_t t = now - p->socket_last_active[i]; + if (t >= p->default_timeout) { ptime = 0; break; } else { - ptime = TCN_MIN(p->max_ttl - t, ptime); + ptime = TCN_MIN(p->default_timeout - t, ptime); } } } @@ -384,7 +384,7 @@ TCN_IMPLEMENT_CALL(jint, Poll, poll)(TCN if (remove) do_remove(p, fd); else - update_ttl(p, fd, now); + update_last_active(p, fd, now); fd ++; } (*e)->SetLongArrayRegion(e, set, 0, num * 2, p->set); @@ -405,9 +405,9 @@ TCN_IMPLEMENT_CALL(jint, Poll, maintain) TCN_ASSERT(pollset != 0); /* Check for timeout sockets */ - if (p->max_ttl > 0) { + if (p->default_timeout > 0) { for (i = 0; i < p->nelts; i++) { - if ((now - p->socket_ttl[i]) >= p->max_ttl) { + if ((now - p->socket_last_active[i]) >= p->default_timeout) { fd = p->socket_set[i]; p->set[num++] = P2J(fd.client_data); } @@ -426,7 +426,7 @@ TCN_IMPLEMENT_CALL(jint, Poll, maintain) } } } - else if (p->max_ttl == 0) { + else if (p->default_timeout == 0) { for (i = 0; i < p->nelts; i++) { fd = p->socket_set[i]; p->set[num++] = P2J(fd.client_data); @@ -449,14 +449,14 @@ TCN_IMPLEMENT_CALL(void, Poll, setTtl)(T { tcn_pollset_t *p = J2P(pollset, tcn_pollset_t *); UNREFERENCED_STDARGS; - p->max_ttl = J2T(ttl); + p->default_timeout = J2T(ttl); } TCN_IMPLEMENT_CALL(jlong, Poll, getTtl)(TCN_STDARGS, jlong pollset) { tcn_pollset_t *p = J2P(pollset, tcn_pollset_t *); UNREFERENCED_STDARGS; - return (jlong)p->max_ttl; + return (jlong)p->default_timeout; } TCN_IMPLEMENT_CALL(jint, Poll, pollset)(TCN_STDARGS, jlong pollset, --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org