mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-29 14:44:17 +00:00
add some write locks to the core and a function to unregister event bindings
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8880 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
34215ce00f
commit
43b712b7b1
10 files changed
+269
-63
No files matched your search
@@ -242,6 +242,7 @@ static struct {
|
||||
switch_mutex_t *mutex;
|
||||
switch_memory_pool_t *pool;
|
||||
int running;
|
||||
switch_event_node_t *node;
|
||||
} globals;
|
||||
|
||||
|
||||
@@ -1182,7 +1183,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load)
|
||||
}
|
||||
|
||||
/* Subscribe to presence request events */
|
||||
if (switch_event_bind(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY,
|
||||
pres_event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't subscribe to presence request events!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -1215,7 +1217,10 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown)
|
||||
fifo_node_t *node;
|
||||
switch_memory_pool_t *pool = globals.pool;
|
||||
switch_mutex_t *mutex = globals.mutex;
|
||||
|
||||
|
||||
switch_event_unbind(&globals.node);
|
||||
switch_event_free_subclass(FIFO_EVENT);
|
||||
|
||||
switch_mutex_lock(mutex);
|
||||
|
||||
globals.running = 0;
|
||||
@@ -1229,6 +1234,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown)
|
||||
free(pop);
|
||||
}
|
||||
}
|
||||
|
||||
switch_core_hash_destroy(&node->caller_hash);
|
||||
switch_core_hash_destroy(&node->consumer_hash);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ static void event_handler(switch_event_t *event)
|
||||
return;
|
||||
}
|
||||
|
||||
if (event->subclass && !strcmp(event->subclass->name, MULTICAST_EVENT)) {
|
||||
if (event->subclass_name && !strcmp(event->subclass_name, MULTICAST_EVENT)) {
|
||||
/* ignore our own events to avoid ping pong */
|
||||
return;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ static void event_handler(switch_event_t *event)
|
||||
if (globals.event_list[(uint8_t) SWITCH_EVENT_ALL]) {
|
||||
send = 1;
|
||||
} else if ((globals.event_list[(uint8_t) event->event_id])) {
|
||||
if (event->event_id != SWITCH_EVENT_CUSTOM || (event->subclass && switch_core_hash_find(globals.event_hash, event->subclass->name))) {
|
||||
if (event->event_id != SWITCH_EVENT_CUSTOM || (event->subclass_name && switch_core_hash_find(globals.event_hash, event->subclass_name))) {
|
||||
send = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ static void event_handler(switch_event_t *event)
|
||||
if (l->event_list[SWITCH_EVENT_ALL]) {
|
||||
send = 1;
|
||||
} else if ((l->event_list[event->event_id])) {
|
||||
if (event->event_id != SWITCH_EVENT_CUSTOM || !event->subclass || (switch_core_hash_find(l->event_hash, event->subclass->name))) {
|
||||
if (event->event_id != SWITCH_EVENT_CUSTOM || !event->subclass_name || (switch_core_hash_find(l->event_hash, event->subclass_name))) {
|
||||
send = 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user