binding->process.pid = msg->from;
binding->listener = listener;
- switch_thread_rwlock_wrlock(globals.listener_rwlock);
+ switch_thread_rwlock_wrlock(globals.bindings_rwlock);
for (ptr = bindings.head; ptr && ptr->next; ptr = ptr->next);
}
switch_xml_set_binding_sections(bindings.search_binding, switch_xml_get_binding_sections(bindings.search_binding) | section);
- switch_thread_rwlock_unlock(globals.listener_rwlock);
+ switch_thread_rwlock_unlock(globals.bindings_rwlock);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sections %d\n", switch_xml_get_binding_sections(bindings.search_binding));
{
struct erlang_binding *ptr, *lst = NULL;
- switch_thread_rwlock_wrlock(globals.listener_rwlock);
+ switch_thread_rwlock_wrlock(globals.bindings_rwlock);
switch_xml_set_binding_sections(bindings.search_binding, SWITCH_XML_SECTION_MAX);
if (ptr->next) {
bindings.head = ptr->next;
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removed all (only?) listeners\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removed all (only?) binding\n");
bindings.head = NULL;
break;
}
lst->next = NULL;
}
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removed listener\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removed binding\n");
} else {
switch_xml_set_binding_sections(bindings.search_binding, switch_xml_get_binding_sections(bindings.search_binding) | ptr->section);
}
}
- switch_thread_rwlock_unlock(globals.listener_rwlock);
+ switch_thread_rwlock_unlock(globals.bindings_rwlock);
}
section = switch_xml_parse_section_string((char *) sectionstr);
+ switch_thread_rwlock_rdlock(globals.bindings_rwlock);
+
for (ptr = bindings.head; ptr; ptr = ptr->next) {
if (ptr->section != section)
continue;
switch_mutex_unlock(ptr->listener->sock_mutex);
}
+ switch_thread_rwlock_unlock(globals.bindings_rwlock);
+
ei_x_free(&buf);
if (!p) {
memset(&prefs, 0, sizeof(prefs));
switch_thread_rwlock_create(&globals.listener_rwlock, pool);
+ switch_thread_rwlock_create(&globals.bindings_rwlock, pool);
switch_mutex_init(&globals.fetch_reply_mutex, SWITCH_MUTEX_DEFAULT, pool);
switch_mutex_init(&globals.listener_count_mutex, SWITCH_MUTEX_UNNESTED, pool);
switch_core_hash_init(&globals.fetch_reply_hash, pool);