You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ruediger Pluem <rp...@apache.org> on 2007/06/08 11:05:28 UTC

Re: svn commit: r545385 - /httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c


On 06/08/2007 05:17 AM, pquerna@apache.org wrote:
> Author: pquerna
> Date: Thu Jun  7 20:17:41 2007
> New Revision: 545385
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=545385
> Log:
> Use the absolute timeout, as provided by mod_ssl, rather than trying to calculate a relative timeout. (which did it wrong anyways).
> 
> Modified:
>     httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c
> 
> Modified: httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c?view=diff&rev=545385&r1=545384&r2=545385
> ==============================================================================
> --- httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c (original)
> +++ httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c Thu Jun  7 20:17:41 2007
> @@ -189,10 +189,6 @@
>          return FALSE;
>      }
>  
> -    timeout -= time(NULL);
> -
> -    timeout = apr_time_sec(timeout);
> -
>      rv = apr_memcache_set(memctxt, strkey, (char*)ucp, nData, timeout, 0);


Maybe I am missing the point here, but timeout was already in seconds and according to the
docs apr_memcache_set expects the ttl to be set in seconds. So I guess the only thing that was
wrong above was

timeout = apr_time_sec(timeout);

as it tried to convert something to seconds that was already in seconds.
Doing

timeout -= time(NULL);

should work IMHO.

Regards

RĂ¼diger



Re: svn commit: r545385 - /httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c

Posted by Paul Querna <ch...@force-elite.com>.
Ruediger Pluem wrote:
> 
> On 06/08/2007 05:17 AM, pquerna@apache.org wrote:
>> Author: pquerna
>> Date: Thu Jun  7 20:17:41 2007
>> New Revision: 545385
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=545385
>> Log:
>> Use the absolute timeout, as provided by mod_ssl, rather than trying to calculate a relative timeout. (which did it wrong anyways).
>>
>> Modified:
>>     httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c
>>
>> Modified: httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c?view=diff&rev=545385&r1=545384&r2=545385
>> ==============================================================================
>> --- httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c (original)
>> +++ httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c Thu Jun  7 20:17:41 2007
>> @@ -189,10 +189,6 @@
>>          return FALSE;
>>      }
>>  
>> -    timeout -= time(NULL);
>> -
>> -    timeout = apr_time_sec(timeout);
>> -
>>      rv = apr_memcache_set(memctxt, strkey, (char*)ucp, nData, timeout, 0);
> 
> 
> Maybe I am missing the point here, but timeout was already in seconds and according to the
> docs apr_memcache_set expects the ttl to be set in seconds. So I guess the only thing that was
> wrong above was
> 
> timeout = apr_time_sec(timeout);
> 
> as it tried to convert something to seconds that was already in seconds.
> Doing
> 
> timeout -= time(NULL);
> 

It would work, but its not needed. The memcache protocol supports both
relative timeouts and absolute times[1].  mod_ssl already gave us an
absolute time, so we can just pass it down.

[1] - From the protocol docs:
http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt
"""this number of seconds may not exceed 60*60*24*30 (number
of seconds in 30 days); if the number sent by a client is larger than
that, the server will consider it to be real Unix time value rather
than an offset from current time."""


-Paul