mirror of
https://github.com/curl/curl.git
synced 2025-09-13 15:42:39 +03:00
openssl: shortcut store_expired for negative timeouts
Avoid some unnecessary computation if the timeout is negative. Spotted by CodeSonar Closes #13919
This commit is contained in:
parent
a945393e51
commit
5e8d921f55
|
@ -3310,14 +3310,15 @@ cached_x509_store_expired(const struct Curl_easy *data,
|
||||||
const struct ossl_x509_share *mb)
|
const struct ossl_x509_share *mb)
|
||||||
{
|
{
|
||||||
const struct ssl_general_config *cfg = &data->set.general_ssl;
|
const struct ssl_general_config *cfg = &data->set.general_ssl;
|
||||||
struct curltime now = Curl_now();
|
if(cfg->ca_cache_timeout < 0)
|
||||||
timediff_t elapsed_ms = Curl_timediff(now, mb->time);
|
return FALSE;
|
||||||
timediff_t timeout_ms = cfg->ca_cache_timeout * (timediff_t)1000;
|
else {
|
||||||
|
struct curltime now = Curl_now();
|
||||||
|
timediff_t elapsed_ms = Curl_timediff(now, mb->time);
|
||||||
|
timediff_t timeout_ms = cfg->ca_cache_timeout * (timediff_t)1000;
|
||||||
|
|
||||||
if(timeout_ms < 0)
|
return elapsed_ms >= timeout_ms;
|
||||||
return false;
|
}
|
||||||
|
|
||||||
return elapsed_ms >= timeout_ms;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
Loading…
Reference in New Issue
Block a user