mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-27 05:34:17 +00:00
another efficiency pass on sofia and refactoring of 3c685bff25 to be more efficient
This commit is contained in:
1 parent
e67bb432d1
commit
6d2b3256c3
5 files changed
+114
-80
No files matched your search
@@ -1517,38 +1517,28 @@ void *SWITCH_THREAD_FUNC sofia_presence_event_thread_run(switch_thread_t *thread
|
||||
while (mod_sofia_globals.running == 1) {
|
||||
int count = 0;
|
||||
|
||||
if (switch_queue_trypop(mod_sofia_globals.presence_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_queue_pop(mod_sofia_globals.presence_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_t *event = (switch_event_t *) pop;
|
||||
|
||||
if (!pop) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (event->event_id == SWITCH_EVENT_CONFERENCE_DATA) {
|
||||
|
||||
switch(event->event_id) {
|
||||
case SWITCH_EVENT_MESSAGE_WAITING:
|
||||
actual_sofia_presence_mwi_event_handler(event);
|
||||
break;
|
||||
case SWITCH_EVENT_CONFERENCE_DATA:
|
||||
conference_data_event_handler(event);
|
||||
} else {
|
||||
break;
|
||||
default:
|
||||
actual_sofia_presence_event_handler(event);
|
||||
}
|
||||
|
||||
switch_event_destroy(&event);
|
||||
count++;
|
||||
}
|
||||
|
||||
if (switch_queue_trypop(mod_sofia_globals.mwi_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_t *event = (switch_event_t *) pop;
|
||||
|
||||
if (!pop) {
|
||||
break;
|
||||
}
|
||||
|
||||
actual_sofia_presence_mwi_event_handler(event);
|
||||
switch_event_destroy(&event);
|
||||
count++;
|
||||
}
|
||||
|
||||
if (!count) {
|
||||
switch_yield(100000);
|
||||
}
|
||||
}
|
||||
|
||||
while (switch_queue_trypop(mod_sofia_globals.presence_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
|
||||
@@ -1556,11 +1546,6 @@ void *SWITCH_THREAD_FUNC sofia_presence_event_thread_run(switch_thread_t *thread
|
||||
switch_event_destroy(&event);
|
||||
}
|
||||
|
||||
while (switch_queue_trypop(mod_sofia_globals.mwi_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
|
||||
switch_event_t *event = (switch_event_t *) pop;
|
||||
switch_event_destroy(&event);
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Event Thread Ended\n");
|
||||
|
||||
switch_mutex_lock(mod_sofia_globals.mutex);
|
||||
@@ -1610,19 +1595,6 @@ void sofia_presence_event_handler(switch_event_t *event)
|
||||
}
|
||||
}
|
||||
|
||||
void sofia_presence_mwi_event_handler(switch_event_t *event)
|
||||
{
|
||||
switch_event_t *cloned_event;
|
||||
|
||||
switch_event_dup(&cloned_event, event);
|
||||
switch_assert(cloned_event);
|
||||
switch_queue_push(mod_sofia_globals.mwi_queue, cloned_event);
|
||||
|
||||
if (!EVENT_THREAD_STARTED) {
|
||||
sofia_presence_event_thread_start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int sofia_presence_sub_reg_callback(void *pArg, int argc, char **argv, char **columnNames)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user