提交 a1ee1a03 authored 作者: Phil Lavin's avatar Phil Lavin 提交者: Phil Lavin

FS-8978: [mod_redis] Fix limit counter not decrementing on hangup

The limit counter value is not automatically decremented in Redis when
the call is hung up. This results in it only ever counting up and the
limit being eventually hit.

The linked list is moved on too early. When `limit_pvt` is checked, it
is `NULL`. This means the `decr` command is never sent to Redis.
上级 4e8c2249
...@@ -197,13 +197,14 @@ SWITCH_LIMIT_RELEASE(hiredis_limit_release) ...@@ -197,13 +197,14 @@ SWITCH_LIMIT_RELEASE(hiredis_limit_release)
while (tmp) { while (tmp) {
profile = switch_core_hash_find(mod_hiredis_globals.profiles, limit_pvt->realm); profile = switch_core_hash_find(mod_hiredis_globals.profiles, limit_pvt->realm);
hashkey = switch_mprintf("decr %s", tmp->limit_key); hashkey = switch_mprintf("decr %s", tmp->limit_key);
limit_pvt = tmp->next;
if ( limit_pvt && (limit_pvt->interval > 0) && (hiredis_profile_execute_sync(profile, hashkey, &response) != SWITCH_STATUS_SUCCESS)) { if ( limit_pvt && (limit_pvt->interval > 0) && (hiredis_profile_execute_sync(profile, hashkey, &response) != SWITCH_STATUS_SUCCESS)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "hiredis: profile[%s] error executing [%s] because [%s]\n", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "hiredis: profile[%s] error executing [%s] because [%s]\n",
tmp->realm, hashkey, response); tmp->realm, hashkey, response);
} }
limit_pvt = tmp->next;
tmp = limit_pvt; tmp = limit_pvt;
switch_safe_free(response); switch_safe_free(response);
switch_safe_free(hashkey); switch_safe_free(hashkey);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论