Module: sip-router
Branch: master
Commit: 922e034e35410d2008d7d4d907fd535c1f5ad3fa
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=922e034…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Apr 14 22:33:13 2014 +0200
acc: if db_insert_mode==2, use async db insert to store the record
- the acc record will be stored via async framework if db driver
implement insert_async()
---
modules/acc/acc.c | 10 ++++++++++
modules/acc/acc_cdr.c | 5 +++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/modules/acc/acc.c b/modules/acc/acc.c
index c44a9e4..60c3e38 100644
--- a/modules/acc/acc.c
+++ b/modules/acc/acc.c
@@ -488,6 +488,11 @@ int acc_db_request( struct sip_msg *rq)
LM_ERR("failed to insert delayed into database\n");
return -1;
}
+ } else if(acc_db_insert_mode==2 && acc_dbf.insert_async!=NULL) {
+ if (acc_dbf.insert_async(db_handle, db_keys, db_vals, m) < 0) {
+ LM_ERR("failed to insert async into database\n");
+ return -1;
+ }
} else {
if (acc_dbf.insert(db_handle, db_keys, db_vals, m) < 0) {
LM_ERR("failed to insert into database\n");
@@ -504,6 +509,11 @@ int acc_db_request( struct sip_msg *rq)
LM_ERR("failed to insert delayed into database\n");
return -1;
}
+ } else if(acc_db_insert_mode==2 && acc_dbf.insert_async!=NULL) {
+ if(acc_dbf.insert_async(db_handle,db_keys,db_vals,m+n)<0) {
+ LM_ERR("failed to insert async into database\n");
+ return -1;
+ }
} else {
if (acc_dbf.insert(db_handle, db_keys, db_vals, m+n) < 0) {
LM_ERR("failed to insert into database\n");
diff --git a/modules/acc/acc_cdr.c b/modules/acc/acc_cdr.c
index 68792e9..1ae0aa0 100644
--- a/modules/acc/acc_cdr.c
+++ b/modules/acc/acc_cdr.c
@@ -183,6 +183,11 @@ static int db_write_cdr( struct dlg_cell* dialog,
LM_ERR("failed to insert delayed into database\n");
return -1;
}
+ } else if(acc_db_insert_mode==2 && df->insert_async!=NULL) {
+ if (df->insert_async(dh, db_cdr_keys, db_cdr_vals, m) < 0) {
+ LM_ERR("failed to insert async into database\n");
+ return -1;
+ }
} else {
if (df->insert(dh, db_cdr_keys, db_cdr_vals, m) < 0) {
LM_ERR("failed to insert into database\n");