FS-8075 updates for limit release case

This commit is contained in:
William King 2015-09-04 14:45:37 -07:00
parent 6445012dd6
commit 16d600c035
2 changed files with 8 additions and 2 deletions

View File

@ -2,5 +2,6 @@
2. add lock for hiredis_profile for destroy vs running commands
3. Look into refactor/cleanup of xml processing
4. Add tab complete for profile names for APIs, and possibly for supported actions(and in theory look into key listing from redis)
5. Add linked list session pvt structure for keeping track of limit incr's on a session by session basis

View File

@ -93,7 +93,7 @@ SWITCH_STANDARD_API(raw_api)
data++;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "hiredis: debug: profile[%s] for command [%s]\n", input, data);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hiredis: debug: profile[%s] for command [%s]\n", input, data);
profile = switch_core_hash_find(mod_hiredis_globals.profiles, input);
@ -127,7 +127,7 @@ SWITCH_LIMIT_INCR(hiredis_limit_incr)
time_t now = switch_epoch_time_now(NULL);
switch_status_t status = SWITCH_STATUS_SUCCESS;
if ( !zstr(realm) ) {
if ( zstr(realm) ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "hiredis: realm must be defined\n");
switch_goto_status(SWITCH_STATUS_GENERR, done);
}
@ -185,6 +185,11 @@ SWITCH_LIMIT_RELEASE(hiredis_limit_release)
switch_goto_status(SWITCH_STATUS_GENERR, done);
}
if ( !realm && !resource ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "hiredis does not yet support release on NULL realm[%s] and resource[%s]\n", realm, resource);
switch_goto_status(SWITCH_STATUS_GENERR, done);
}
hashkey = switch_mprintf("decr %s", resource);
if ( hiredis_profile_execute_sync(profile, hashkey, &response) != SWITCH_STATUS_SUCCESS) {