Skip to content
Snippets Groups Projects
Commit dd239e9f authored by George Joseph's avatar George Joseph Committed by Gerrit Code Review
Browse files

Merge "res_stun_monitor: Don't fail to load if DNS resolution fails"

parents b18bfb76 f6600f2c
Branches
Tags
No related merge requests found
...@@ -269,7 +269,7 @@ static int stun_start_monitor(void) ...@@ -269,7 +269,7 @@ static int stun_start_monitor(void)
* \retval 0 on success. * \retval 0 on success.
* \retval -1 on error. * \retval -1 on error.
*/ */
static int setup_stunaddr(const char *value) static int setup_stunaddr(const char *value, int reload)
{ {
char *val; char *val;
char *host_str; char *host_str;
...@@ -305,8 +305,12 @@ static int setup_stunaddr(const char *value) ...@@ -305,8 +305,12 @@ static int setup_stunaddr(const char *value)
stun_addr.ss.ss_family = AF_INET; stun_addr.ss.ss_family = AF_INET;
if (ast_get_ip(&stun_addr, host_str)) { if (ast_get_ip(&stun_addr, host_str)) {
ast_log(LOG_WARNING, "Unable to lookup STUN server '%s'\n", host_str); ast_log(LOG_WARNING, "Unable to lookup STUN server '%s'\n", host_str);
ast_free(host_str);
return -1; /* Only treat this as fatal if we are reloading */
if (reload) {
ast_free(host_str);
return -1;
}
} }
/* Save STUN server information. */ /* Save STUN server information. */
...@@ -348,7 +352,7 @@ static int load_config(int startup) ...@@ -348,7 +352,7 @@ static int load_config(int startup)
for (v = ast_variable_browse(cfg, "general"); v; v = v->next) { for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
if (!strcasecmp(v->name, "stunaddr")) { if (!strcasecmp(v->name, "stunaddr")) {
if (setup_stunaddr(v->value)) { if (setup_stunaddr(v->value, !startup)) {
ast_log(LOG_WARNING, "Invalid STUN server address: %s at line %d\n", ast_log(LOG_WARNING, "Invalid STUN server address: %s at line %d\n",
v->value, v->lineno); v->value, v->lineno);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment