<p>Holger Hans Peter Freyther has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19701">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_http_media_cache: Allow to configure the dns timeout<br><br>ASTERISK-30340<br><br>Change-Id: I6d8af55d670ea342a3faeeb96860f5a9919777b0<br>---<br>M res/res_http_media_cache.c<br>1 file changed, 24 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/01/19701/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_http_media_cache.c b/res/res_http_media_cache.c</span><br><span>index c8ff0e4..f4e6c06 100644</span><br><span>--- a/res/res_http_media_cache.c</span><br><span>+++ b/res/res_http_media_cache.c</span><br><span>@@ -58,6 +58,9 @@</span><br><span>                             <configOption name="redir_protocols"></span><br><span>                                        <synopsis>The comma separated list of allowed protocols for redirects. Available with curl 7.85.0 or later. See https://curl.se/libcurl/c/CURLOPT_REDIR_PROTOCOLS_STR.html for details.</synopsis></span><br><span>                               </configOption></span><br><span style="color: hsl(120, 100%, 40%);">+                         <configOption name="dns_cache_timeout_seconds"></span><br><span style="color: hsl(120, 100%, 40%);">+                                       <synopsis>The life-time for DNS cache entries. See https://curl.se/libcurl/c/CURLOPT_DNS_CACHE_TIMEOUT.html for details.</synopsis></span><br><span style="color: hsl(120, 100%, 40%);">+                               </configOption></span><br><span>                        </configObject></span><br><span>                </configFile></span><br><span>  </configInfo></span><br><span>@@ -87,6 +90,7 @@</span><br><span> static char *cache_curl_proxy = NULL;</span><br><span> static char *cache_curl_protocols = NULL;</span><br><span> static char *cache_curl_redir_protocols = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+static int cache_dns_cache_timeout = 60;</span><br><span> </span><br><span> </span><br><span> /*! \brief Data passed to cURL callbacks */</span><br><span>@@ -400,6 +404,13 @@</span><br><span> #endif</span><br><span>   }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ CURLcode rc = curl_easy_setopt(curl, CURLOPT_DNS_CACHE_TIMEOUT, cache_dns_cache_timeout);</span><br><span style="color: hsl(120, 100%, 40%);">+     if (rc != CURLE_OK) {</span><br><span style="color: hsl(120, 100%, 40%);">+         ast_log(AST_LOG_ERROR, "Setting dns_cache_timeout to '%d' failed: %d\n", cache_dns_cache_timeout, rc);</span><br><span style="color: hsl(120, 100%, 40%);">+              curl_easy_cleanup(curl);</span><br><span style="color: hsl(120, 100%, 40%);">+              return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  return curl;</span><br><span> }</span><br><span> </span><br><span>@@ -652,6 +663,8 @@</span><br><span>                                  ast_free(cache_curl_redir_protocols);</span><br><span>                                        cache_curl_redir_protocols = ast_strdup(var->value);</span><br><span> #endif</span><br><span style="color: hsl(120, 100%, 40%);">+                             } else if (strcasecmp(var->name, "dns_cache_timeout_seconds") == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                    cache_dns_cache_timeout = strtoul(var->value, NULL, 0);</span><br><span>                           } else {</span><br><span>                                     ast_log(LOG_ERROR, "Unrecognized variable '%s' in category '%s'\n", var->name, cat);</span><br><span>                                    ast_config_destroy(cfg);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19701">change 19701</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/19701"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 20 </div>
<div style="display:none"> Gerrit-Change-Id: I6d8af55d670ea342a3faeeb96860f5a9919777b0 </div>
<div style="display:none"> Gerrit-Change-Number: 19701 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Holger Hans Peter Freyther <automatic@freyther.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>