]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Skinny: update profile IP address if changed during socket creation
authorMathieu Parent <math.parent@gmail.com>
Fri, 25 Feb 2011 19:59:26 +0000 (20:59 +0100)
committerMathieu Parent <math.parent@gmail.com>
Fri, 25 Feb 2011 20:06:21 +0000 (21:06 +0100)
src/mod/endpoints/mod_skinny/mod_skinny.c

index a30b0fd6665917745467fd842994c9e6dc10bf5d..071e8c54d88c0b7f8fa5b56e015c9e3383be9804 100644 (file)
@@ -1523,6 +1523,7 @@ static void *SWITCH_THREAD_FUNC skinny_profile_run(switch_thread_t *thread, void
 
 new_socket:
        while(globals.running) {
+               char *listening_ip = NULL;
                switch_clear_flag_locked(profile, PFLAG_RESPAWN);
                rv = switch_sockaddr_info_get(&sa, profile->ip, SWITCH_UNSPEC, profile->port, 0, tmp_pool);
                if (rv)
@@ -1539,6 +1540,10 @@ new_socket:
                rv = switch_socket_listen(profile->sock, 5);
                if (rv)
                        goto sock_fail;
+               switch_sockaddr_ip_get(&listening_ip, sa);
+               if (!profile->ip || strcmp(listening_ip, profile->ip)) {
+                       profile->ip = switch_core_strdup(profile->pool, listening_ip);
+               }
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Socket up listening on %s:%u\n", profile->ip, profile->port);
 
                break;