change from sqlite hash to newly added one

This commit is contained in:
Anthony Minessale committed 2014-03-09 00:37:17 +05:00
1 parent 32cce8027e
commit 804ef7709d
83 files changed
+1868 -835

No files matched your search

@@ -63,7 +63,7 @@ blacklist_t *blacklist_create(const char *name)
switch_assert(bl);
bl->pool = pool;
switch_core_hash_init(&bl->list, pool);
switch_core_hash_init(&bl->list);
switch_mutex_init(&bl->list_mutex, SWITCH_MUTEX_NESTED, pool);
return bl;
@@ -126,10 +126,10 @@ static switch_status_t do_config(switch_bool_t reload)
switch_mutex_lock(globals.lists_mutex);
/* Destroy any active lists */
while ((hi = switch_hash_first(NULL, globals.lists))) {
while ((hi = switch_core_hash_first( globals.lists))) {
const void *key;
void *val;
switch_hash_this(hi, &key, NULL, &val);
switch_core_hash_this(hi, &key, NULL, &val);
blacklist_free((blacklist_t*)val);
switch_core_hash_delete(globals.lists, (const char*)key);
}
@@ -282,8 +282,8 @@ SWITCH_STANDARD_API(blacklist_api_function)
switch_mutex_lock(globals.lists_mutex);
if (switch_file_open(&fd, filename, SWITCH_FOPEN_WRITE | SWITCH_FOPEN_TRUNCATE | SWITCH_FOPEN_CREATE, SWITCH_FPROT_OS_DEFAULT, globals.pool)
== SWITCH_STATUS_SUCCESS) {
for (hi = switch_hash_first(NULL, bl->list); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &var, NULL, &val);
for (hi = switch_core_hash_first( bl->list); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, &var, NULL, &val);
switch_file_printf(fd, "%s\n", (char *)var);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "adding %s to the dump file\n", (char *)var);
}
@@ -317,10 +317,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_blacklist_load)
memset(&globals, 0, sizeof(globals));
globals.pool = pool;
switch_core_hash_init(&globals.files, globals.pool);
switch_core_hash_init(&globals.files);
switch_mutex_init(&globals.files_mutex, SWITCH_MUTEX_NESTED, globals.pool);
switch_core_hash_init(&globals.lists, globals.pool);
switch_core_hash_init(&globals.lists);
switch_mutex_init(&globals.lists_mutex, SWITCH_MUTEX_NESTED, globals.pool);
do_config(SWITCH_FALSE);
@@ -3198,12 +3198,12 @@ SWITCH_STANDARD_API(cc_config_api_function)
switch_hash_index_t *hi;
stream->write_function(stream, "%s", "name|strategy|moh_sound|time_base_score|tier_rules_apply|tier_rule_wait_second|tier_rule_wait_multiply_level|tier_rule_no_agent_no_wait|discard_abandoned_after|abandoned_resume_allowed|max_wait_time|max_wait_time_with_no_agent|max_wait_time_with_no_agent_time_reached|record_template\n");
switch_mutex_lock(globals.mutex);
for (hi = switch_hash_first(NULL, globals.queue_hash); hi; hi = switch_hash_next(hi)) {
for (hi = switch_core_hash_first( globals.queue_hash); hi; hi = switch_core_hash_next(hi)) {
void *val = NULL;
const void *key;
switch_ssize_t keylen;
cc_queue_t *queue;
switch_hash_this(hi, &key, &keylen, &val);
switch_core_hash_this(hi, &key, &keylen, &val);
queue = (cc_queue_t *) val;
stream->write_function(stream, "%s|%s|%s|%s|%s|%d|%s|%s|%d|%s|%d|%d|%d|%s\n", queue->name, queue->strategy, queue->moh, queue->time_base_score, (queue->tier_rules_apply?"true":"false"), queue->tier_rule_wait_second, (queue->tier_rule_wait_multiply_level?"true":"false"), (queue->tier_rule_no_agent_no_wait?"true":"false"), queue->discard_abandoned_after, (queue->abandoned_resume_allowed?"true":"false"), queue->max_wait_time, queue->max_wait_time_with_no_agent, queue->max_wait_time_with_no_agent_time_reached, queue->record_template);
queue = NULL;
@@ -3251,7 +3251,7 @@ SWITCH_STANDARD_API(cc_config_api_function)
switch_hash_index_t *hi;
int queue_count = 0;
switch_mutex_lock(globals.mutex);
for (hi = switch_hash_first(NULL, globals.queue_hash); hi; hi = switch_hash_next(hi)) {
for (hi = switch_core_hash_first( globals.queue_hash); hi; hi = switch_core_hash_next(hi)) {
queue_count++;
}
switch_mutex_unlock(globals.mutex);
@@ -3309,7 +3309,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load)
memset(&globals, 0, sizeof(globals));
globals.pool = pool;
switch_core_hash_init(&globals.queue_hash, globals.pool);
switch_core_hash_init(&globals.queue_hash);
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
if ((status = load_config()) != SWITCH_STATUS_SUCCESS) {
@@ -3394,8 +3394,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_callcenter_shutdown)
}
switch_mutex_lock(globals.mutex);
while ((hi = switch_hash_first(NULL, globals.queue_hash))) {
switch_hash_this(hi, &key, &keylen, &val);
while ((hi = switch_core_hash_first( globals.queue_hash))) {
switch_core_hash_this(hi, &key, &keylen, &val);
queue = (cc_queue_t *) val;
switch_core_hash_delete(globals.queue_hash, queue->name);
@@ -5278,8 +5278,8 @@ static switch_status_t list_conferences(const char *line, const char *cursor, sw
const void *vvar;
switch_mutex_lock(globals.hash_mutex);
for (hi = switch_hash_first(NULL, globals.conference_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &vvar, NULL, &val);
for (hi = switch_core_hash_first( globals.conference_hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, &vvar, NULL, &val);
switch_console_push_match(&my_matches, (const char *) vvar);
}
switch_mutex_unlock(globals.hash_mutex);
@@ -5770,9 +5770,9 @@ static switch_status_t conf_api_sub_list(conference_obj_t *conference, switch_st
if (conference == NULL) {
switch_mutex_lock(globals.hash_mutex);
for (hi = switch_hash_first(NULL, globals.conference_hash); hi; hi = switch_hash_next(hi)) {
for (hi = switch_core_hash_first( globals.conference_hash); hi; hi = switch_core_hash_next(hi)) {
int fcount = 0;
switch_hash_this(hi, NULL, NULL, &val);
switch_core_hash_this(hi, NULL, NULL, &val);
conference = (conference_obj_t *) val;
stream->write_function(stream, "Conference %s (%u member%s rate: %u%s flags: ",
@@ -6249,8 +6249,8 @@ static switch_status_t conf_api_sub_xml_list(conference_obj_t *conference, switc
if (conference == NULL) {
switch_mutex_lock(globals.hash_mutex);
for (hi = switch_hash_first(NULL, globals.conference_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
for (hi = switch_core_hash_first( globals.conference_hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, NULL, NULL, &val);
conference = (conference_obj_t *) val;
x_conference = switch_xml_add_child_d(x_conferences, "conference", off++);
@@ -10050,7 +10050,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_conference_load)
globals.conference_pool = pool;
/* Setup a hash to store conferences by name */
switch_core_hash_init(&globals.conference_hash, globals.conference_pool);
switch_core_hash_init(&globals.conference_hash);
switch_mutex_init(&globals.conference_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
switch_mutex_init(&globals.id_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
switch_mutex_init(&globals.hash_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
+1 -1
View File
@@ -652,7 +652,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_db_load)
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
switch_mutex_init(&globals.db_hash_mutex, SWITCH_MUTEX_NESTED, globals.pool);
switch_core_hash_init(&globals.db_hash, pool);
switch_core_hash_init(&globals.db_hash);
status = switch_event_reserve_subclass(LIMIT_EVENT_USAGE);
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_INUSE) {
@@ -1038,7 +1038,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_directory_load)
memset(&globals, 0, sizeof(globals));
globals.pool = pool;
switch_core_hash_init(&globals.profile_hash, globals.pool);
switch_core_hash_init(&globals.profile_hash);
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
if ((status = load_config(SWITCH_FALSE)) != SWITCH_STATUS_SUCCESS) {
@@ -1070,8 +1070,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_directory_shutdown)
switch_mutex_lock(globals.mutex);
while ((hi = switch_hash_first(NULL, globals.profile_hash))) {
switch_hash_this(hi, &key, &keylen, &val);
while ((hi = switch_core_hash_first( globals.profile_hash))) {
switch_core_hash_this(hi, &key, &keylen, &val);
profile = (dir_profile_t *) val;
switch_core_hash_delete(globals.profile_hash, profile->name);
+2 -2
View File
@@ -5591,9 +5591,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
switch_file_interface_t *file_interface;
globals.pool = pool;
switch_core_hash_init(&globals.pickup_hash, globals.pool);
switch_core_hash_init(&globals.pickup_hash);
switch_mutex_init(&globals.pickup_mutex, SWITCH_MUTEX_NESTED, globals.pool);
switch_core_hash_init(&globals.mutex_hash, globals.pool);
switch_core_hash_init(&globals.mutex_hash);
switch_mutex_init(&globals.mutex_mutex, SWITCH_MUTEX_NESTED, globals.pool);
/* connect my internal structure to the blank pointer passed to me */
+23 -23
View File
@@ -660,7 +660,7 @@ static void fifo_init_use_count(void)
if (globals.use_hash) {
switch_core_hash_destroy(&globals.use_hash);
}
switch_core_hash_init(&globals.use_hash, globals.pool);
switch_core_hash_init(&globals.use_hash);
switch_mutex_unlock(globals.use_mutex);
}
@@ -935,7 +935,7 @@ static fifo_node_t *create_node(const char *name, uint32_t importance, switch_mu
switch_assert(node->fifo_list[x]);
}
switch_core_hash_init(&node->consumer_hash, node->pool);
switch_core_hash_init(&node->consumer_hash);
switch_thread_rwlock_create(&node->rwlock, node->pool);
switch_mutex_init(&node->mutex, SWITCH_MUTEX_NESTED, node->pool);
switch_mutex_init(&node->update_mutex, SWITCH_MUTEX_NESTED, node->pool);
@@ -975,8 +975,8 @@ static int node_idle_consumers(fifo_node_t *node)
int total = 0;
switch_mutex_lock(node->mutex);
for (hi = switch_hash_first(NULL, node->consumer_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &var, NULL, &val);
for (hi = switch_core_hash_first( node->consumer_hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, &var, NULL, &val);
session = (switch_core_session_t *) val;
channel = switch_core_session_get_channel(session);
if (!switch_channel_test_flag(channel, CF_BRIDGED)) {
@@ -3802,14 +3802,14 @@ static int xml_hash(switch_xml_t xml, switch_hash_t *hash, char *container, char
x_tmp = switch_xml_add_child_d(xml, container, cc_off++);
switch_assert(x_tmp);
for (hi = switch_hash_first(NULL, hash); hi; hi = switch_hash_next(hi)) {
for (hi = switch_core_hash_first( hash); hi; hi = switch_core_hash_next(hi)) {
int c_off = 0, d_off = 0;
const char *status;
const char *ts;
char url_buf[512] = "";
char *encoded;
switch_hash_this(hi, &var, NULL, &val);
switch_core_hash_this(hi, &var, NULL, &val);
session = (switch_core_session_t *) val;
channel = switch_core_session_get_channel(session);
x_caller = switch_xml_add_child_d(x_tmp, tag, c_off++);
@@ -3987,8 +3987,8 @@ void dump_hash(switch_hash_t *hash, switch_stream_handle_t *stream)
const void *var;
switch_mutex_lock(globals.mutex);
for (hi = switch_hash_first(NULL, hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &var, NULL, &val);
for (hi = switch_core_hash_first( hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, &var, NULL, &val);
stream->write_function(stream, " %s\n", (char *)var);
}
switch_mutex_unlock(globals.mutex);
@@ -4002,8 +4002,8 @@ void node_dump(switch_stream_handle_t *stream)
fifo_node_t *node;
void *val;
switch_mutex_lock(globals.mutex);
for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
for (hi = switch_core_hash_first( globals.fifo_hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, NULL, NULL, &val);
if ((node = (fifo_node_t *) val)) {
stream->write_function(stream, "node: %s\n"
" outbound_name: %s\n"
@@ -4100,8 +4100,8 @@ SWITCH_STANDARD_API(fifo_api_function)
switch_assert(x_report);
if (argc < 2) {
for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &var, NULL, &val);
for (hi = switch_core_hash_first( globals.fifo_hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, &var, NULL, &val);
node = (fifo_node_t *) val;
switch_mutex_lock(node->mutex);
@@ -4137,8 +4137,8 @@ SWITCH_STANDARD_API(fifo_api_function)
}
} else if (!strcasecmp(argv[0], "count")) {
if (argc < 2) {
for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &var, NULL, &val);
for (hi = switch_core_hash_first( globals.fifo_hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, &var, NULL, &val);
node = (fifo_node_t *) val;
switch_mutex_lock(node->update_mutex);
stream->write_function(stream, "%s:%d:%d:%d:%d:%d\n", (char *) var, node->consumer_count, node_caller_count(node), node->member_count, node->ring_consumer_count, node_idle_consumers(node));
@@ -4158,8 +4158,8 @@ SWITCH_STANDARD_API(fifo_api_function)
}
} else if (!strcasecmp(argv[0], "has_outbound")) {
if (argc < 2) {
for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &var, NULL, &val);
for (hi = switch_core_hash_first( globals.fifo_hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, &var, NULL, &val);
node = (fifo_node_t *) val;
switch_mutex_lock(node->update_mutex);
stream->write_function(stream, "%s:%d\n", (char *) var, node->has_outbound);
@@ -4359,8 +4359,8 @@ static switch_status_t load_config(int reload, int del_all)
fifo_node_t *node;
void *val;
switch_mutex_lock(globals.mutex);
for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
for (hi = switch_core_hash_first( globals.fifo_hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, NULL, NULL, &val);
if ((node = (fifo_node_t *) val) && node->is_static && node->ready == 1) {
node->ready = -1;
}
@@ -4775,12 +4775,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load)
}
globals.pool = pool;
switch_core_hash_init(&globals.fifo_hash, globals.pool);
switch_core_hash_init(&globals.fifo_hash);
switch_core_hash_init(&globals.caller_orig_hash, globals.pool);
switch_core_hash_init(&globals.consumer_orig_hash, globals.pool);
switch_core_hash_init(&globals.bridge_hash, globals.pool);
switch_core_hash_init(&globals.use_hash, globals.pool);
switch_core_hash_init(&globals.caller_orig_hash);
switch_core_hash_init(&globals.consumer_orig_hash);
switch_core_hash_init(&globals.bridge_hash);
switch_core_hash_init(&globals.use_hash);
switch_mutex_init(&globals.caller_orig_mutex, SWITCH_MUTEX_NESTED, globals.pool);
switch_mutex_init(&globals.consumer_orig_mutex, SWITCH_MUTEX_NESTED, globals.pool);
switch_mutex_init(&globals.bridge_mutex, SWITCH_MUTEX_NESTED, globals.pool);
+24 -24
View File
@@ -161,7 +161,7 @@ SWITCH_LIMIT_INCR(limit_incr_hash)
/* This is the first limit check on this channel, create a hashtable, set our prviate data */
pvt = (limit_hash_private_t *) switch_core_session_alloc(session, sizeof(limit_hash_private_t));
memset(pvt, 0, sizeof(limit_hash_private_t));
switch_core_hash_init(&pvt->hash, switch_core_session_get_pool(session));
switch_core_hash_init(&pvt->hash);
switch_channel_set_private(channel, "limit_hash", pvt);
}
@@ -291,13 +291,13 @@ SWITCH_LIMIT_RELEASE(limit_release_hash)
/* clear for uuid */
if (realm == NULL && resource == NULL) {
/* Loop through the channel's hashtable which contains mapping to all the limit_hash_item_t referenced by that channel */
while ((hi = switch_hash_first(NULL, pvt->hash))) {
while ((hi = switch_core_hash_first( pvt->hash))) {
void *val = NULL;
const void *key;
switch_ssize_t keylen;
limit_hash_item_t *item = NULL;
switch_hash_this(hi, &key, &keylen, &val);
switch_core_hash_this(hi, &key, &keylen, &val);
item = (limit_hash_item_t *) val;
item->total_usage--;
@@ -391,7 +391,7 @@ SWITCH_LIMIT_STATUS(limit_status_hash)
switch_thread_rwlock_rdlock(globals.limit_hash_rwlock);
for (hi = switch_hash_first(NULL, globals.limit_hash); hi; switch_hash_next(hi)) {
for (hi = switch_core_hash_first( globals.limit_hash); hi; switch_core_hash_next(hi)) {
count++;
}
@@ -623,12 +623,12 @@ SWITCH_STANDARD_API(hash_dump_function)
if (mode & 1) {
switch_thread_rwlock_rdlock(globals.limit_hash_rwlock);
for (hi = switch_hash_first(NULL, globals.limit_hash); hi; hi = switch_hash_next(hi)) {
for (hi = switch_core_hash_first( globals.limit_hash); hi; hi = switch_core_hash_next(hi)) {
void *val = NULL;
const void *key;
switch_ssize_t keylen;
limit_hash_item_t *item;
switch_hash_this(hi, &key, &keylen, &val);
switch_core_hash_this(hi, &key, &keylen, &val);
item = (limit_hash_item_t *)val;
@@ -639,11 +639,11 @@ SWITCH_STANDARD_API(hash_dump_function)
if (mode & 2) {
switch_thread_rwlock_rdlock(globals.db_hash_rwlock);
for (hi = switch_hash_first(NULL, globals.db_hash); hi; hi = switch_hash_next(hi)) {
for (hi = switch_core_hash_first( globals.db_hash); hi; hi = switch_core_hash_next(hi)) {
void *val = NULL;
const void *key;
switch_ssize_t keylen;
switch_hash_this(hi, &key, &keylen, &val);
switch_core_hash_this(hi, &key, &keylen, &val);
if (realm) {
if (strstr(key, realmvalue)) {
stream->write_function(stream, "D/%s/%s\n", key, (char*)val);
@@ -679,12 +679,12 @@ SWITCH_STANDARD_API(hash_remote_function)
stream->write_function(stream, "Remote connections:\nName\t\t\tState\n");
switch_thread_rwlock_rdlock(globals.remote_hash_rwlock);
for (hi = switch_hash_first(NULL, globals.remote_hash); hi; hi = switch_hash_next(hi)) {
for (hi = switch_core_hash_first( globals.remote_hash); hi; hi = switch_core_hash_next(hi)) {
void *val;
const void *key;
switch_ssize_t keylen;
limit_remote_t *item;
switch_hash_this(hi, &key, &keylen, &val);
switch_core_hash_this(hi, &key, &keylen, &val);
item = (limit_remote_t *)val;
stream->write_function(stream, "%s\t\t\t%s\n", item->name, state_str(item->state));
@@ -756,7 +756,7 @@ limit_remote_t *limit_remote_create(const char *name, const char *host, uint16_t
r->interval = interval;
switch_thread_rwlock_create(&r->rwlock, pool);
switch_core_hash_init(&r->index, pool);
switch_core_hash_init(&r->index);
switch_thread_rwlock_rdlock(globals.remote_hash_rwlock);
switch_core_hash_insert(globals.remote_hash, name, r);
@@ -780,11 +780,11 @@ void limit_remote_destroy(limit_remote_t **r)
switch_thread_rwlock_wrlock((*r)->rwlock);
/* Free hashtable data */
for (hi = switch_hash_first(NULL, (*r)->index); hi; hi = switch_hash_next(hi)) {
for (hi = switch_core_hash_first( (*r)->index); hi; hi = switch_core_hash_next(hi)) {
void *val;
const void *key;
switch_ssize_t keylen;
switch_hash_this(hi, &key, &keylen, &val);
switch_core_hash_this(hi, &key, &keylen, &val);
free(val);
}
@@ -803,13 +803,13 @@ static limit_hash_item_t get_remote_usage(const char *key) {
switch_hash_index_t *hi;
switch_thread_rwlock_rdlock(globals.remote_hash_rwlock);
for (hi = switch_hash_first(NULL, globals.remote_hash); hi; hi = switch_hash_next(hi)) {
for (hi = switch_core_hash_first( globals.remote_hash); hi; hi = switch_core_hash_next(hi)) {
void *val;
const void *hashkey;
switch_ssize_t keylen;
limit_remote_t *remote;
limit_hash_item_t *item;
switch_hash_this(hi, &hashkey, &keylen, &val);
switch_core_hash_this(hi, &hashkey, &keylen, &val);
remote = (limit_remote_t *)val;
if (remote->state != REMOTE_UP) {
@@ -983,9 +983,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_hash_load)
switch_thread_rwlock_create(&globals.limit_hash_rwlock, globals.pool);
switch_thread_rwlock_create(&globals.db_hash_rwlock, globals.pool);
switch_thread_rwlock_create(&globals.remote_hash_rwlock, globals.pool);
switch_core_hash_init(&globals.limit_hash, pool);
switch_core_hash_init(&globals.db_hash, pool);
switch_core_hash_init(&globals.remote_hash, globals.pool);
switch_core_hash_init(&globals.limit_hash);
switch_core_hash_init(&globals.db_hash);
switch_core_hash_init(&globals.remote_hash);
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
@@ -1031,8 +1031,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown)
limit_remote_t *item = NULL;
switch_thread_rwlock_rdlock(globals.remote_hash_rwlock);
if ((hi = switch_hash_first(NULL, globals.remote_hash))) {
switch_hash_this(hi, &key, &keylen, &val);
if ((hi = switch_core_hash_first( globals.remote_hash))) {
switch_core_hash_this(hi, &key, &keylen, &val);
item = (limit_remote_t *)val;
}
switch_thread_rwlock_unlock(globals.remote_hash_rwlock);
@@ -1050,20 +1050,20 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown)
switch_thread_rwlock_wrlock(globals.limit_hash_rwlock);
switch_thread_rwlock_wrlock(globals.db_hash_rwlock);
while ((hi = switch_hash_first(NULL, globals.limit_hash))) {
while ((hi = switch_core_hash_first( globals.limit_hash))) {
void *val = NULL;
const void *key;
switch_ssize_t keylen;
switch_hash_this(hi, &key, &keylen, &val);
switch_core_hash_this(hi, &key, &keylen, &val);
free(val);
switch_core_hash_delete(globals.limit_hash, key);
}
while ((hi = switch_hash_first(NULL, globals.db_hash))) {
while ((hi = switch_core_hash_first( globals.db_hash))) {
void *val = NULL;
const void *key;
switch_ssize_t keylen;
switch_hash_this(hi, &key, &keylen, &val);
switch_core_hash_this(hi, &key, &keylen, &val);
free(val);
switch_core_hash_delete(globals.db_hash, key);
}
+5 -5
View File
@@ -1822,7 +1822,7 @@ static switch_status_t do_config(void)
cookie_file = val;
} else if (!strcasecmp(var, "enable-post-var")) {
if (!vars_map && need_vars_map == 0) {
if (switch_core_hash_init(&vars_map, globals.pool) != SWITCH_STATUS_SUCCESS) {
if (switch_core_hash_init(&vars_map) != SWITCH_STATUS_SUCCESS) {
need_vars_map = -1;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't init params hash!\n");
continue;
@@ -3011,8 +3011,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_httapi_load)
switch_dir_make_recursive(globals.cache_path, SWITCH_DEFAULT_DIR_PERMS, pool);
switch_core_hash_init(&globals.profile_hash, globals.pool);
switch_core_hash_init_case(&globals.parse_hash, globals.pool, SWITCH_FALSE);
switch_core_hash_init(&globals.profile_hash);
switch_core_hash_init_case(&globals.parse_hash, SWITCH_FALSE);
bind_parser("execute", parse_execute);
bind_parser("sms", parse_sms);
@@ -3063,8 +3063,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_httapi_shutdown)
void *val;
const void *vvar;
for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &vvar, NULL, &val);
for (hi = switch_core_hash_first( globals.profile_hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, &vvar, NULL, &val);
profile = (client_profile_t *) val;
switch_event_destroy(&profile->dial_params.app_list);
switch_event_destroy(&profile->var_params.expand_var_list);
@@ -1631,8 +1631,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_http_cache_load)
memset(&gcache, 0, sizeof(url_cache_t));
gcache.pool = pool;
switch_core_hash_init(&gcache.map, gcache.pool);
switch_core_hash_init(&gcache.profiles, gcache.pool);
switch_core_hash_init(&gcache.map);
switch_core_hash_init(&gcache.profiles);
switch_core_hash_init_nocase(&gcache.fqdn_profiles, gcache.pool);
switch_mutex_init(&gcache.mutex, SWITCH_MUTEX_UNNESTED, gcache.pool);
switch_thread_rwlock_create(&gcache.shutdown_lock, gcache.pool);
+4 -4
View File
@@ -900,7 +900,7 @@ static switch_status_t lcr_do_lookup(callback_t *cb_struct)
}
/* allocate the dedup hash */
if (switch_core_hash_init(&cb_struct->dedup_hash, cb_struct->pool) != SWITCH_STATUS_SUCCESS) {
if (switch_core_hash_init(&cb_struct->dedup_hash) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_ERROR, "Error initializing the dedup hash\n");
return SWITCH_STATUS_GENERR;
}
@@ -1067,7 +1067,7 @@ static switch_status_t lcr_load_config()
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to determine database RANDOM function\n");
};
switch_core_hash_init(&globals.profile_hash, globals.pool);
switch_core_hash_init(&globals.profile_hash);
if ((x_profiles = switch_xml_child(cfg, "profiles"))) {
for (x_profile = switch_xml_child(x_profiles, "profile"); x_profile; x_profile = x_profile->next) {
char *name = (char *) switch_xml_attr_soft(x_profile, "name");
@@ -2038,8 +2038,8 @@ SWITCH_STANDARD_API(dialplan_lcr_admin_function)
}
switch_assert(argv[0]);
if (!strcasecmp(argv[0], "show") && !strcasecmp(argv[1], "profiles")) {
for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
for (hi = switch_core_hash_first( globals.profile_hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, NULL, NULL, &val);
profile = (profile_t *) val;
stream->write_function(stream, "Name:\t\t%s\n", profile->name);
+3 -3
View File
@@ -97,7 +97,7 @@ SWITCH_LIMIT_INCR(limit_incr_redis)
} else {
/* This is the first limit check on this channel, create a hashtable, set our prviate data and add a state handler */
pvt = (limit_redis_private_t *) switch_core_session_alloc(session, sizeof(limit_redis_private_t));
switch_core_hash_init(&pvt->hash, switch_core_session_get_pool(session));
switch_core_hash_init(&pvt->hash));
switch_mutex_init(&pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
switch_channel_set_private(channel, "limit_redis", pvt);
}
@@ -172,13 +172,13 @@ SWITCH_LIMIT_RELEASE(limit_release_redis)
/* clear for uuid */
if (realm == NULL && resource == NULL) {
/* Loop through the channel's hashtable which contains mapping to all the limit_redis_item_t referenced by that channel */
while ((hi = switch_hash_first(NULL, pvt->hash))) {
while ((hi = switch_core_hash_first( pvt->hash))) {
void *p_val = NULL;
const void *p_key;
char *p_uuid_key = NULL;
switch_ssize_t keylen;
switch_hash_this(hi, &p_key, &keylen, &p_val);
switch_core_hash_this(hi, &p_key, &keylen, &p_val);
if (credis_decr(redis, (const char*)p_key, &val) != 0) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Couldn't decrement value corresponding to %s\n", (char *)p_key);
@@ -493,7 +493,7 @@ switch_status_t load_configuration(switch_bool_t reload)
}
switch_core_new_memory_pool(&spandsp_globals.config_pool);
switch_core_hash_init(&spandsp_globals.tones, spandsp_globals.config_pool);
switch_core_hash_init(&spandsp_globals.tones);
spandsp_globals.modem_dialplan = "XML";
spandsp_globals.modem_context = "default";
+3 -3
View File
@@ -139,8 +139,8 @@ SWITCH_STANDARD_API(dump_hash)
switch_thread_rwlock_rdlock(globals.spy_hash_lock);
for (hi = switch_hash_first(NULL, globals.spy_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &key, NULL, &val);
for (hi = switch_core_hash_first( globals.spy_hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, &key, NULL, &val);
spy = (spy_t *) val;
stream->write_function(stream, "%s :");
@@ -319,7 +319,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spy_load)
globals.pool = pool;
switch_core_hash_init(&globals.spy_hash, pool);
switch_core_hash_init(&globals.spy_hash);
switch_thread_rwlock_create(&globals.spy_hash_lock, pool);
globals.spy_count = 0;
@@ -170,13 +170,13 @@ static void do_unload(void) {
switch_mutex_lock(MUTEX);
while ((hi = switch_hash_first(NULL, globals.translate_profiles))) {
while ((hi = switch_core_hash_first( globals.translate_profiles))) {
void *val = NULL;
const void *key;
switch_ssize_t keylen;
translate_rule_t *rl, *nrl;
switch_hash_this(hi, &key, &keylen, &val);
switch_core_hash_this(hi, &key, &keylen, &val);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "deleting translate profile [%s]\n", (char *) key);
for (nrl = val; rl;) {
@@ -201,7 +201,7 @@ static void do_load(void)
{
switch_mutex_lock(MUTEX);
switch_core_hash_init(&globals.translate_profiles, globals.pool);
switch_core_hash_init(&globals.translate_profiles);
switch_thread_rwlock_create(&globals.profile_hash_rwlock, globals.pool);
load_config();
@@ -71,7 +71,7 @@ static valet_lot_t *valet_find_lot(const char *name, switch_bool_t create)
switch_zmalloc(lot, sizeof(*lot));
lot->name = strdup(name);
switch_mutex_init(&lot->mutex, SWITCH_MUTEX_NESTED, globals.pool);
switch_core_hash_init(&lot->hash, NULL);
switch_core_hash_init(&lot->hash);
switch_core_hash_insert(globals.hash, name, lot);
}
switch_mutex_unlock(globals.mutex);
@@ -120,8 +120,8 @@ static void check_timeouts(void)
}
globals.last_timeout_check = now;
for (hi = switch_hash_first(NULL, globals.hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &var, NULL, &val);
for (hi = switch_core_hash_first( globals.hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, &var, NULL, &val);
switch_console_push_match(&matches, (const char *) var);
}
switch_mutex_unlock(globals.mutex);
@@ -135,8 +135,8 @@ static void check_timeouts(void)
top:
for (i_hi = switch_hash_first(NULL, lot->hash); i_hi; i_hi = switch_hash_next(i_hi)) {
switch_hash_this(i_hi, &i_var, NULL, &i_val);
for (i_hi = switch_core_hash_first( lot->hash); i_hi; i_hi = switch_core_hash_next(i_hi)) {
switch_core_hash_this(i_hi, &i_var, NULL, &i_val);
i_ext = (char *) i_var;
token = (valet_token_t *) i_val;
@@ -167,9 +167,9 @@ static int find_longest(valet_lot_t *lot, int min, int max)
time_t now = switch_epoch_time_now(NULL);
switch_mutex_lock(lot->mutex);
for (i_hi = switch_hash_first(NULL, lot->hash); i_hi; i_hi = switch_hash_next(i_hi)) {
for (i_hi = switch_core_hash_first( lot->hash); i_hi; i_hi = switch_core_hash_next(i_hi)) {
int i;
switch_hash_this(i_hi, &i_var, NULL, &i_val);
switch_core_hash_this(i_hi, &i_var, NULL, &i_val);
token = (valet_token_t *) i_val;
cur = (now - token->start_time);
i = atoi(token->ext);
@@ -257,8 +257,8 @@ static int valet_lot_count(valet_lot_t *lot)
now = switch_epoch_time_now(NULL);
switch_mutex_lock(lot->mutex);
for (i_hi = switch_hash_first(NULL, lot->hash); i_hi; i_hi = switch_hash_next(i_hi)) {
switch_hash_this(i_hi, &i_var, NULL, &i_val);
for (i_hi = switch_core_hash_first( lot->hash); i_hi; i_hi = switch_core_hash_next(i_hi)) {
switch_core_hash_this(i_hi, &i_var, NULL, &i_val);
token = (valet_token_t *) i_val;
if (token->timeout > 0 && (token->timeout < now || token->timeout == 1)) {
continue;
@@ -738,13 +738,13 @@ SWITCH_STANDARD_API(valet_info_function)
stream->write_function(stream, "<lots>\n");
switch_mutex_lock(globals.mutex);
for (hi = switch_hash_first(NULL, globals.hash); hi; hi = switch_hash_next(hi)) {
for (hi = switch_core_hash_first( globals.hash); hi; hi = switch_core_hash_next(hi)) {
switch_hash_index_t *i_hi;
const void *i_var;
void *i_val;
char *i_ext;
switch_hash_this(hi, &var, NULL, &val);
switch_core_hash_this(hi, &var, NULL, &val);
name = (char *) var;
lot = (valet_lot_t *) val;
@@ -754,10 +754,10 @@ SWITCH_STANDARD_API(valet_info_function)
stream->write_function(stream, " <lot name=\"%s\">\n", name);
switch_mutex_lock(lot->mutex);
for (i_hi = switch_hash_first(NULL, lot->hash); i_hi; i_hi = switch_hash_next(i_hi)) {
for (i_hi = switch_core_hash_first( lot->hash); i_hi; i_hi = switch_core_hash_next(i_hi)) {
valet_token_t *token;
switch_hash_this(i_hi, &i_var, NULL, &i_val);
switch_core_hash_this(i_hi, &i_var, NULL, &i_val);
i_ext = (char *) i_var;
token = (valet_token_t *) i_val;
@@ -848,8 +848,8 @@ static void pres_event_handler(switch_event_t *event)
const char *nvar;
switch_mutex_lock(globals.mutex);
for (hi = switch_hash_first(NULL, globals.hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &var, NULL, &val);
for (hi = switch_core_hash_first( globals.hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, &var, NULL, &val);
nvar = (const char *) var;
if (!strchr(nvar, '@') || switch_stristr(domain_name, nvar)) {
@@ -930,7 +930,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_valet_parking_load)
memset(&globals, 0, sizeof(globals));
globals.pool = pool;
switch_core_hash_init(&globals.hash, NULL);
switch_core_hash_init(&globals.hash);
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
/* connect my internal structure to the blank pointer passed to me */
@@ -3866,9 +3866,9 @@ SWITCH_STANDARD_API(boxcount_api_function)
/* Kept for backwards-compatibility */
switch_hash_index_t *hi;
switch_mutex_lock(globals.mutex);
if ((hi = switch_hash_first(NULL, globals.profile_hash))) {
if ((hi = switch_core_hash_first( globals.profile_hash))) {
void *val;
switch_hash_this(hi, NULL, NULL, &val);
switch_core_hash_this(hi, NULL, NULL, &val);
profile = (vm_profile_t *) val;
total_new_messages = total_saved_messages = 0;
message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages,
@@ -4020,8 +4020,8 @@ static void actual_message_query_handler(switch_event_t *event)
"Cound not find a profile for domain: [%s] Returning 0 messages\nWhen message-query-exact-match is enabled you must have a dedicated vm profile per distinct domain name you wish to use.\n", domain);
}
} else {
for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
for (hi = switch_core_hash_first( globals.profile_hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, NULL, NULL, &val);
profile = (vm_profile_t *) val;
parse_profile();
@@ -4923,8 +4923,8 @@ SWITCH_STANDARD_API(voicemail_api_function)
} else if (!strcasecmp(argv[0], "status")) {
stream->write_function(stream, "============================\n");
switch_mutex_lock(globals.mutex);
for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
for (hi = switch_core_hash_first( globals.profile_hash); hi; hi = switch_core_hash_next(hi)) {
switch_core_hash_this(hi, NULL, NULL, &val);
profile = (vm_profile_t *) val;
stream->write_function(stream, "Profile: %s\n", profile->name);
}
@@ -4958,8 +4958,8 @@ SWITCH_STANDARD_API(voicemail_api_function)
void *value;
switch_mutex_lock(globals.mutex);
for (index = switch_hash_first(NULL, globals.profile_hash); index; index = switch_hash_next(index)) {
switch_hash_this(index, NULL, NULL, &value);
for (index = switch_core_hash_first( globals.profile_hash); index; index = switch_core_hash_next(index)) {
switch_core_hash_this(index, NULL, NULL, &value);
profile = (vm_profile_t *) value;
if (profile) {
switch_thread_rwlock_rdlock(profile->rwlock);
@@ -6179,7 +6179,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_voicemail_load)
memset(&globals, 0, sizeof(globals));
globals.pool = pool;
switch_core_hash_init(&globals.profile_hash, globals.pool);
switch_core_hash_init(&globals.profile_hash);
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
switch_mutex_lock(globals.mutex);
@@ -6261,8 +6261,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_voicemail_shutdown)
}
switch_mutex_lock(globals.mutex);
while ((hi = switch_hash_first(NULL, globals.profile_hash))) {
switch_hash_this(hi, &key, &keylen, &val);
while ((hi = switch_core_hash_first( globals.profile_hash))) {
switch_core_hash_this(hi, &key, &keylen, &val);
profile = (vm_profile_t *) val;
switch_core_hash_delete(globals.profile_hash, profile->name);