From: Anthony Minessale Date: Thu, 29 Nov 2012 14:35:28 +0000 (-0600) Subject: add mutex around hash as this code can now be executed concurrently X-Git-Tag: v1.3.7~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9267b1faf684b5d50c7014b6b9bb7645aac4757;p=thirdparty%2Ffreeswitch.git add mutex around hash as this code can now be executed concurrently --- diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 7961f24e08..507ace4391 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1019,6 +1019,7 @@ static int debounce_check(sofia_profile_t *profile, const char *user, const char snprintf(key, sizeof(key), "%s%s", user, host); + switch_mutex_lock(profile->ireg_mutex); if ((last = switch_core_hash_find(profile->mwi_debounce_hash, key))) { if (now - *last > 30) { *last = now; @@ -1030,6 +1031,7 @@ static int debounce_check(sofia_profile_t *profile, const char *user, const char switch_core_hash_insert(profile->mwi_debounce_hash, key, last); r = 1; } + switch_mutex_unlock(profile->ireg_mutex); return r; }