]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
freetdm: ss7 - bug fix for race condition on start
authorKonrad Hammel <konrad@sangoma.com>
Mon, 21 Mar 2011 22:10:38 +0000 (18:10 -0400)
committerKonrad Hammel <konrad@sangoma.com>
Fri, 25 Mar 2011 14:37:29 +0000 (10:37 -0400)
libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c

index 92e6c8be4b819ef4aee4a953aa9960983da3605c..f774dfcd836add407abbf25aec730f56e89d80df 100644 (file)
@@ -1370,21 +1370,6 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span)
        ftdm_clear_flag (span, FTDM_SPAN_STOP_THREAD);
        ftdm_clear_flag (span, FTDM_SPAN_IN_THREAD);
 
-       /* activate all the configured ss7 links */
-       if (ft_to_sngss7_activate_all()) {
-               SS7_CRITICAL ("Failed to activate LibSngSS7!\n");
-               return FTDM_FAIL;
-       }
-
-       /*start the span monitor thread */
-       if (ftdm_thread_create_detached (ftdm_sangoma_ss7_run, span) != FTDM_SUCCESS) {
-               SS7_CRITICAL ("Failed to start Span Monitor Thread!\n");
-               return FTDM_FAIL;
-       }
-
-       /* confirm the state of all isup interfaces*/
-       check_status_of_all_isup_intf();
-
        /* throw the channels in pause */
        for (x = 1; x < (span->chan_count + 1); x++) {
                /* extract the channel structure and sngss7 channel data */
@@ -1437,6 +1422,18 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span)
                ftdm_mutex_unlock(ftdmchan->mutex);
        }
 
+       /* activate all the configured ss7 links */
+       if (ft_to_sngss7_activate_all()) {
+               SS7_CRITICAL ("Failed to activate LibSngSS7!\n");
+               return FTDM_FAIL;
+       }
+
+       /*start the span monitor thread */
+       if (ftdm_thread_create_detached (ftdm_sangoma_ss7_run, span) != FTDM_SUCCESS) {
+               SS7_CRITICAL ("Failed to start Span Monitor Thread!\n");
+               return FTDM_FAIL;
+       }
+
        SS7_DEBUG ("Finished starting span %s:%u.\n", span->name, span->span_id);
 
        return FTDM_SUCCESS;