提交 123d0865 authored 作者: Nathan Neulinger's avatar Nathan Neulinger

FS-5431: --resolve fix socket creation loop for mod_skinny to avoid segfault

上级 32bddaa6
...@@ -1543,7 +1543,7 @@ static void *SWITCH_THREAD_FUNC skinny_profile_run(switch_thread_t *thread, void ...@@ -1543,7 +1543,7 @@ static void *SWITCH_THREAD_FUNC skinny_profile_run(switch_thread_t *thread, void
} }
new_socket: new_socket:
while(globals.running) { while(globals.running && !profile->sock) {
char *listening_ip = NULL; char *listening_ip = NULL;
switch_clear_flag_locked(profile, PFLAG_RESPAWN); switch_clear_flag_locked(profile, PFLAG_RESPAWN);
rv = switch_sockaddr_info_get(&sa, profile->ip, SWITCH_UNSPEC, profile->port, 0, tmp_pool); rv = switch_sockaddr_info_get(&sa, profile->ip, SWITCH_UNSPEC, profile->port, 0, tmp_pool);
...@@ -1570,6 +1570,10 @@ new_socket: ...@@ -1570,6 +1570,10 @@ new_socket:
break; break;
sock_fail: sock_fail:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error! Could not listen on %s:%u\n", profile->ip, profile->port); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error! Could not listen on %s:%u\n", profile->ip, profile->port);
if (profile->sock) {
close_socket(&profile->sock, profile);
profile->sock = NULL;
}
switch_yield(100000); switch_yield(100000);
} }
...@@ -1582,6 +1586,8 @@ sock_fail: ...@@ -1582,6 +1586,8 @@ sock_fail:
goto fail; goto fail;
} }
assert(profile->sock);
if ((rv = switch_socket_accept(&inbound_socket, profile->sock, listener_pool))) { if ((rv = switch_socket_accept(&inbound_socket, profile->sock, listener_pool))) {
if (!globals.running) { if (!globals.running) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论