]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
LIBDING-13
authorAnthony Minessale <anthony.minessale@gmail.com>
Sun, 15 Mar 2009 16:56:15 +0000 (16:56 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sun, 15 Mar 2009 16:56:15 +0000 (16:56 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12612 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/esl/python/events.py
libs/esl/python/single_command.py
libs/libdingaling/src/libdingaling.c
libs/libdingaling/src/libdingaling.h
src/mod/endpoints/mod_dingaling/mod_dingaling.c

index 2c59043447fbd7c98d499f66c60a4d091d0c505c..d6d69117491b743c9124fed3707ea93d0f0850cd 100644 (file)
@@ -5,7 +5,7 @@ import sys
 
 from ESL import *
 
-con = ESLconnection("localhost","8021","ClueCon")
+con = ESLconnection("localhost","8021","rad1ance")
 #are we connected?
 
 if con.connected:
index 977ec9660d759d14bceac830fc971da73f2351ca..9163e1170c3a5c793ff633c146c64da748d56a54 100644 (file)
@@ -4,7 +4,7 @@ import string
 import sys
 from ESL import *
 
-con = ESLconnection("localhost","8021","ClueCon")
+con = ESLconnection("localhost","8021","rad1ance")
 #are we connected?
 
 if con.connected:
index 8999f650919c1f686904ccda9e59651b9d70b5e5..57670be0af3e0c3f4a0758167f102d331018a696 100644 (file)
@@ -1432,7 +1432,7 @@ static void *APR_THREAD_FUNC queue_thread(apr_thread_t *thread, void *obj)
 
        ldl_set_flag_locked(handle, LDL_FLAG_QUEUE_RUNNING);
 
-       while (ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
+       while (ldl_test_flag((&globals), LDL_FLAG_READY) && ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
                ldl_flush_queue(handle, 0);
 
                if (handle->loop_callback(handle) != LDL_STATUS_SUCCESS) {
@@ -1467,7 +1467,7 @@ static void launch_queue_thread(ldl_handle_t *handle)
 
 static void xmpp_connect(ldl_handle_t *handle, char *jabber_id, char *pass)
 {
-       while (ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
+       while (ldl_test_flag((&globals), LDL_FLAG_READY) && ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
                int e;
                char tmp[512], *sl;
 
@@ -1522,7 +1522,7 @@ static void xmpp_connect(ldl_handle_t *handle, char *jabber_id, char *pass)
                        launch_queue_thread(handle);
                }
 
-               while (ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
+               while (ldl_test_flag((&globals), LDL_FLAG_READY) && ldl_test_flag(handle, LDL_FLAG_RUNNING)) {
                        e = iks_recv(handle->parser, 1);
                        if (!ldl_test_flag(handle, LDL_FLAG_TLS) && handle->loop_callback) {
                                if (handle->loop_callback(handle) != LDL_STATUS_SUCCESS) {
@@ -2166,6 +2166,12 @@ ldl_status ldl_session_get_payloads(ldl_session_t *session, ldl_payload_t **payl
        }
 }
 
+ldl_status ldl_global_terminate(void)
+{
+       ldl_clear_flag_locked((&globals), LDL_FLAG_READY);
+       return LDL_STATUS_SUCCESS;
+}
+
 ldl_status ldl_global_init(int debug)
 {
        if (ldl_test_flag((&globals), LDL_FLAG_INIT)) {
@@ -2191,6 +2197,7 @@ ldl_status ldl_global_init(int debug)
        globals.logger = default_logger;
        globals.avatar_hash = apr_hash_make(globals.memory_pool);
        ldl_set_flag_locked((&globals), LDL_FLAG_INIT);
+       ldl_set_flag_locked((&globals), LDL_FLAG_READY);
        
        return LDL_STATUS_SUCCESS;
 }
index e788515f087cf645d18e4f54502ae1d6ce2fab46..45b3add49716b2dc7794404ab256b1f094adfb18 100644 (file)
@@ -603,6 +603,9 @@ ldl_status ldl_handle_destroy(ldl_handle_t **handle);
   \param log_stream the new log stream
 */
 void ldl_handle_set_log_stream(ldl_handle_t *handle, FILE *log_stream);
+
+ldl_status ldl_global_terminate(void);
+
 ///\}
 
 
index 77b6cdb3c4a46992ac398c21a4981f573cd568c5..8e7b49a9007792fee667023db1b69c5c122136fe 100644 (file)
@@ -1868,10 +1868,11 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_dingaling_shutdown)
        if (globals.running) {
                int x = 0;
                globals.running = 0;
+               ldl_global_terminate();
                while (globals.handles > 0) {
                        switch_yield(100000);
                        x++;
-                       if (x > 10) {
+                       if (x > 100) {
                                break;
                        }
                }