diff --git a/libs/esl/python/events.py b/libs/esl/python/events.py index 2c59043447..d6d6911749 100644 --- a/libs/esl/python/events.py +++ b/libs/esl/python/events.py @@ -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: diff --git a/libs/esl/python/single_command.py b/libs/esl/python/single_command.py index 977ec9660d..9163e1170c 100644 --- a/libs/esl/python/single_command.py +++ b/libs/esl/python/single_command.py @@ -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: diff --git a/libs/libdingaling/src/libdingaling.c b/libs/libdingaling/src/libdingaling.c index 8999f65091..57670be0af 100644 --- a/libs/libdingaling/src/libdingaling.c +++ b/libs/libdingaling/src/libdingaling.c @@ -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; } diff --git a/libs/libdingaling/src/libdingaling.h b/libs/libdingaling/src/libdingaling.h index e788515f08..45b3add497 100644 --- a/libs/libdingaling/src/libdingaling.h +++ b/libs/libdingaling/src/libdingaling.h @@ -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); + ///\} diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 77b6cdb3c4..8e7b49a900 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -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; } }