From a2874b8e33e239563c1e042199ac41d733e045b7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 4 May 2010 09:50:55 -0500 Subject: [PATCH] FSCORE-604 --- src/mod/endpoints/mod_sofia/sofia_reg.c | 2 +- src/switch_core_sqldb.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 1f07b944ef..f045b2599c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1784,7 +1784,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, cb.nplen = nplen; switch_assert(sql != NULL); - sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_nonce_callback, &cb); + sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_reg_nonce_callback, &cb); free(sql); //if (!sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, np, nplen)) { diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index c93e53022a..9ecd011bf2 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -109,7 +109,7 @@ static void sql_close(time_t prune) if (switch_mutex_trylock(dbh->mutex) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Dropping idle DB connection %s\n", key); - + switch (dbh->type) { case SCDB_TYPE_ODBC: { @@ -719,6 +719,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cach status = switch_core_db_exec(dbh->native_handle.core_db_dbh, sql, callback, pdata, &errmsg); if (errmsg) { + dbh->last_used = switch_epoch_time_now(NULL) - (SQL_CACHE_TIMEOUT * 2); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", sql, errmsg); free(errmsg); }