FS-3999 --resolve mod_event_socket: add IPv6 support
Signed-off-by: Travis Cross <tc@traviscross.com>
This commit is contained in:
parent
e8fbaa77a4
commit
8c794acbcc
|
@ -428,7 +428,7 @@ SWITCH_STANDARD_APP(socket_function)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((port_name = strchr(host, ':'))) {
|
||||
if ((port_name = strrchr(host, ':'))) {
|
||||
*port_name++ = '\0';
|
||||
port = (switch_port_t) atoi(port_name);
|
||||
}
|
||||
|
@ -440,12 +440,12 @@ SWITCH_STANDARD_APP(socket_function)
|
|||
|
||||
switch_channel_set_variable(channel, "socket_host", host);
|
||||
|
||||
if (switch_sockaddr_info_get(&sa, host, AF_INET, port, 0, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_sockaddr_info_get(&sa, host, SWITCH_UNSPEC, port, 0, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Socket Error!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (switch_socket_create(&new_sock, AF_INET, SOCK_STREAM, SWITCH_PROTO_TCP, switch_core_session_get_pool(session))
|
||||
if (switch_socket_create(&new_sock, switch_sockaddr_get_family(sa), SOCK_STREAM, SWITCH_PROTO_TCP, switch_core_session_get_pool(session))
|
||||
!= SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Socket Error!\n");
|
||||
return;
|
||||
|
@ -2766,7 +2766,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime)
|
|||
config();
|
||||
|
||||
while (!prefs.done) {
|
||||
rv = switch_sockaddr_info_get(&sa, prefs.ip, SWITCH_INET, prefs.port, 0, pool);
|
||||
rv = switch_sockaddr_info_get(&sa, prefs.ip, SWITCH_UNSPEC, prefs.port, 0, pool);
|
||||
if (rv)
|
||||
goto fail;
|
||||
rv = switch_socket_create(&listen_list.sock, switch_sockaddr_get_family(sa), SOCK_STREAM, SWITCH_PROTO_TCP, pool);
|
||||
|
|
Loading…
Reference in New Issue