From: Michael Jerris Date: Fri, 29 Feb 2008 15:39:56 +0000 (+0000) Subject: tweak error handling on socket app X-Git-Tag: v1.0-rc1~175 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bab5572327dda24bdeeb6caf38737c3f15108da;p=thirdparty%2Ffreeswitch.git tweak error handling on socket app git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7766 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 0117303637..42e7a1ad86 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -223,18 +223,18 @@ SWITCH_STANDARD_APP(socket_function) return; } - switch_channel_set_variable(channel, "socket_host", host); - if ((port_name = strchr(host, ':'))) { *port_name++ = '\0'; port = (switch_port_t) atoi(port_name); } - if ((path = strchr(port_name, '/'))) { + if ((path = strchr((port_name ? port_name : host), '/'))) { *path++ = '\0'; switch_channel_set_variable(channel, "socket_path", path); } + 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) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error!\n"); return;