add mutex around gateway access on per-profile basis and token based access to global profiles to prevent hanging on to the hash mutex while doing sql stmts which may cause issues/slowdowns

This commit is contained in:
Anthony Minessale
2011-06-16 14:32:08 -05:00
parent dc61e08e5d
commit 9df8169d1f
6 changed files with 221 additions and 209 deletions
+3 -1
View File
@@ -4940,7 +4940,7 @@ static void general_event_handler(switch_event_t *event)
}
}
static switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches)
switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
sofia_profile_t *profile = NULL;
switch_hash_index_t *hi;
@@ -4983,9 +4983,11 @@ static switch_status_t list_gateways(const char *line, const char *cursor, switc
profile = (sofia_profile_t *) val;
if (sofia_test_pflag(profile, PFLAG_RUNNING)) {
sofia_gateway_t *gp;
switch_mutex_lock(profile->gw_mutex);
for (gp = profile->gateways; gp; gp = gp->next) {
switch_console_push_match(&my_matches, gp->name);
}
switch_mutex_unlock(profile->gw_mutex);
}
}
switch_mutex_unlock(mod_sofia_globals.hash_mutex);