mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-14 13:28:31 +00:00
FS-6402 part 2
This commit is contained in:
1 parent
5110ee8008
commit
7151d6acea
47 files changed
+198
-154
No files matched your search
@@ -279,7 +279,7 @@ static void do_rotate_all()
|
||||
}
|
||||
|
||||
switch_mutex_lock(globals.mutex);
|
||||
for (hi = switch_core_hash_first( globals.fd_hash); hi; hi = switch_core_hash_next(&hi)) {
|
||||
for (hi = switch_core_hash_first(globals.fd_hash); hi; hi = switch_core_hash_next(&hi)) {
|
||||
switch_core_hash_this(hi, NULL, NULL, &val);
|
||||
fd = (cdr_fd_t *) val;
|
||||
switch_mutex_lock(fd->mutex);
|
||||
@@ -296,7 +296,7 @@ static void do_teardown()
|
||||
void *val;
|
||||
cdr_fd_t *fd;
|
||||
switch_mutex_lock(globals.mutex);
|
||||
for (hi = switch_core_hash_first( globals.fd_hash); hi; hi = switch_core_hash_next(&hi)) {
|
||||
for (hi = switch_core_hash_first(globals.fd_hash); hi; hi = switch_core_hash_next(&hi)) {
|
||||
switch_core_hash_this(hi, NULL, NULL, &val);
|
||||
fd = (cdr_fd_t *) val;
|
||||
switch_mutex_lock(fd->mutex);
|
||||
|
||||
@@ -401,7 +401,7 @@ static void event_handler(switch_event_t *event)
|
||||
}
|
||||
|
||||
if (sig && !strcmp(sig, "HUP")) {
|
||||
for (hi = switch_core_hash_first( globals.fd_hash); hi; hi = switch_core_hash_next(&hi)) {
|
||||
for (hi = switch_core_hash_first(globals.fd_hash); hi; hi = switch_core_hash_next(&hi)) {
|
||||
switch_core_hash_this(hi, NULL, NULL, &val);
|
||||
fd = (cdr_fd_t *) val;
|
||||
switch_mutex_lock(fd->mutex);
|
||||
|
||||
@@ -1132,7 +1132,7 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hashed ref to %s\n", hash);
|
||||
|
||||
switch_thread_rwlock_rdlock(listener->session_rwlock);
|
||||
for (iter = switch_core_hash_first( listener->sessions); iter; iter = switch_core_hash_next(&iter)) {
|
||||
for (iter = switch_core_hash_first(listener->sessions); iter; iter = switch_core_hash_next(&iter)) {
|
||||
switch_core_hash_this(iter, &key, NULL, &val);
|
||||
se = (session_elem_t*)val;
|
||||
if (se->spawn_reply && !strncmp(se->spawn_reply->hash, hash, 100)) {
|
||||
@@ -1154,6 +1154,7 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg,
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch_safe_free(iter);
|
||||
switch_thread_rwlock_unlock(listener->session_rwlock);
|
||||
|
||||
if (found) {
|
||||
|
||||
@@ -364,7 +364,7 @@ session_elem_t *find_session_elem_by_pid(listener_t *listener, erlang_pid *pid)
|
||||
session_elem_t *session = NULL;
|
||||
|
||||
switch_thread_rwlock_rdlock(listener->session_rwlock);
|
||||
for (iter = switch_core_hash_first( listener->sessions); iter; iter = switch_core_hash_next(&iter)) {
|
||||
for (iter = switch_core_hash_first(listener->sessions); iter; iter = switch_core_hash_next(&iter)) {
|
||||
switch_core_hash_this(iter, &key, NULL, &val);
|
||||
|
||||
if (((session_elem_t*)val)->process.type == ERLANG_PID && !ei_compare_pids(pid, &((session_elem_t*)val)->process.pid)) {
|
||||
@@ -373,6 +373,7 @@ session_elem_t *find_session_elem_by_pid(listener_t *listener, erlang_pid *pid)
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch_safe_free(iter);
|
||||
switch_thread_rwlock_unlock(listener->session_rwlock);
|
||||
|
||||
return session;
|
||||
@@ -644,7 +645,7 @@ static switch_status_t check_attached_sessions(listener_t *listener, int *msgs_s
|
||||
|
||||
/* TODO try to minimize critical section */
|
||||
switch_thread_rwlock_rdlock(listener->session_rwlock);
|
||||
for (iter = switch_core_hash_first( listener->sessions); iter; iter = switch_core_hash_next(&iter)) {
|
||||
for (iter = switch_core_hash_first(listener->sessions); iter; iter = switch_core_hash_next(&iter)) {
|
||||
switch_core_hash_this(iter, &key, NULL, &value);
|
||||
sp = (session_elem_t*)value;
|
||||
if (switch_test_flag(sp, LFLAG_WAITING_FOR_PID)) {
|
||||
@@ -1333,7 +1334,7 @@ void destroy_listener(listener_t * listener)
|
||||
|
||||
/* clean up all the attached sessions */
|
||||
switch_thread_rwlock_wrlock(listener->session_rwlock);
|
||||
for (iter = switch_core_hash_first( listener->sessions); iter; iter = switch_core_hash_next(&iter)) {
|
||||
for (iter = switch_core_hash_first(listener->sessions); iter; iter = switch_core_hash_next(&iter)) {
|
||||
switch_core_hash_this(iter, &key, NULL, &value);
|
||||
s = (session_elem_t*)value;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Orphaning call %s\n", s->uuid_str);
|
||||
@@ -1529,7 +1530,7 @@ int count_listener_sessions(listener_t *listener)
|
||||
switch_hash_index_t *iter;
|
||||
|
||||
switch_thread_rwlock_rdlock(listener->session_rwlock);
|
||||
for (iter = switch_core_hash_first( listener->sessions); iter; iter = switch_core_hash_next(&iter)) {
|
||||
for (iter = switch_core_hash_first(listener->sessions); iter; iter = switch_core_hash_next(&iter)) {
|
||||
count++;
|
||||
}
|
||||
switch_thread_rwlock_unlock(listener->session_rwlock);
|
||||
@@ -1750,7 +1751,7 @@ SWITCH_STANDARD_API(erlang_cmd)
|
||||
|
||||
found = 1;
|
||||
switch_thread_rwlock_rdlock(l->session_rwlock);
|
||||
for (iter = switch_core_hash_first( l->sessions); iter; iter = switch_core_hash_next(&iter)) {
|
||||
for (iter = switch_core_hash_first(l->sessions); iter; iter = switch_core_hash_next(&iter)) {
|
||||
empty = 0;
|
||||
switch_core_hash_this(iter, &key, NULL, &value);
|
||||
sp = (session_elem_t*)value;
|
||||
@@ -1791,7 +1792,7 @@ SWITCH_STANDARD_API(erlang_cmd)
|
||||
}
|
||||
stream->write_function(stream, "CUSTOM:\n", switch_event_name(x));
|
||||
|
||||
for (iter = switch_core_hash_first( l->event_hash); iter; iter = switch_core_hash_next(&iter)) {
|
||||
for (iter = switch_core_hash_first(l->event_hash); iter; iter = switch_core_hash_next(&iter)) {
|
||||
switch_core_hash_this(iter, &key, NULL, &val);
|
||||
stream->write_function(stream, "\t%s\n", (char *)key);
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ static void event_handler(switch_event_t *event)
|
||||
struct peer_status *last;
|
||||
char *host;
|
||||
|
||||
for (cur = switch_core_hash_first( globals.peer_hash); cur; cur = switch_core_hash_next(&cur)) {
|
||||
for (cur = switch_core_hash_first(globals.peer_hash); cur; cur = switch_core_hash_next(&cur)) {
|
||||
switch_core_hash_this(cur, &key, &keylen, &value);
|
||||
host = (char *) key;
|
||||
last = (struct peer_status *) value;
|
||||
@@ -351,7 +351,7 @@ SWITCH_STANDARD_API(multicast_peers)
|
||||
char *host;
|
||||
int i = 0;
|
||||
|
||||
for (cur = switch_core_hash_first( globals.peer_hash); cur; cur = switch_core_hash_next(&cur)) {
|
||||
for (cur = switch_core_hash_first(globals.peer_hash); cur; cur = switch_core_hash_next(&cur)) {
|
||||
switch_core_hash_this(cur, &key, &keylen, &value);
|
||||
host = (char *) key;
|
||||
last = (struct peer_status *) value;
|
||||
|
||||
@@ -495,7 +495,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
|
||||
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
|
||||
for (hi = switch_core_hash_first( globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) {
|
||||
for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) {
|
||||
cdr_profile_t *profile;
|
||||
switch_core_hash_this(hi, NULL, NULL, &val);
|
||||
profile = (cdr_profile_t *) val;
|
||||
@@ -518,7 +518,7 @@ static void event_handler(switch_event_t *event)
|
||||
const char *sig = switch_event_get_header(event, "Trapped-Signal");
|
||||
|
||||
if (sig && !strcmp(sig, "HUP")) {
|
||||
for (hi = switch_core_hash_first( globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) {
|
||||
for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) {
|
||||
cdr_profile_t *profile;
|
||||
switch_core_hash_this(hi, NULL, NULL, &val);
|
||||
profile = (cdr_profile_t *) val;
|
||||
@@ -785,7 +785,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_format_cdr_shutdown)
|
||||
switch_event_unbind(&globals.node);
|
||||
switch_core_remove_state_handler(&state_handlers);
|
||||
|
||||
for (hi = switch_core_hash_first( globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) {
|
||||
for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) {
|
||||
cdr_profile_t *profile;
|
||||
switch_core_hash_this(hi, NULL, NULL, &val);
|
||||
profile = (cdr_profile_t *) val;
|
||||
|
||||
@@ -508,6 +508,7 @@ static void pause_when_offline(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch_safe_free(hi);
|
||||
|
||||
if (is_online) {
|
||||
resume_inbound_calling();
|
||||
|
||||
@@ -105,7 +105,7 @@ static void unsubscribe(const char *uuid, const char *signal_type, const char *j
|
||||
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "Unsubscribe %s => %s\n", signal_type, jid);
|
||||
|
||||
/* clean up hash if empty */
|
||||
if (!switch_core_hash_first(signal_subscribers)) {
|
||||
if (switch_core_hash_empty(signal_subscribers)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "Destroy %s subscriber hash\n", signal_type);
|
||||
switch_core_hash_destroy(&signal_subscribers);
|
||||
switch_core_hash_delete(globals.subscribers, key);
|
||||
|
||||
Reference in new issue
Block a user