Module: sip-router
Branch: master
Commit: 20475258957cbf3183e5e771e9fd41dc69336096
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2047525…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Date: Tue Sep 11 12:59:08 2012 +0100
modules_k/pua_db: If PUA finds more than one matching dialog (when there should only be one) delete them all
- A timing difference on multiple-servers can sometimes cause this,
and (if it happens, it doesn't when the clocks are synced) you can
end up with the same error coming out lots because the DB is not
cleaned up.
---
modules_k/pua/pua_db.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/modules_k/pua/pua_db.c b/modules_k/pua/pua_db.c
index 4be51bf..8d72a96 100644
--- a/modules_k/pua/pua_db.c
+++ b/modules_k/pua/pua_db.c
@@ -614,6 +614,8 @@ int convert_temporary_dialog_puadb(ua_pres_t *pres)
query_vals[n_query_cols].val.str_val.len = 0;
n_query_cols++;
+
+
if (pua_dbf.replace != NULL)
{
if (pua_dbf.replace(pua_db, query_cols, query_vals, n_query_cols,
@@ -1212,11 +1214,14 @@ ua_pres_t *get_dialog_puadb(str pres_id, str *pres_uri, ua_pres_t *result, db1_r
pua_dbf.free_result(pua_db, res);
return(NULL);
}
-
- if (nr_rows != 1)
+ else if (nr_rows > 1)
{
- LM_ERR("Too many rows found (%d)\n", nr_rows);
+ LM_ERR("Too many rows found (%d)... deleting\n", nr_rows);
pua_dbf.free_result(pua_db, res);
+
+ if (pua_dbf.delete(pua_db, q_cols, 0, q_vals, n_query_cols) < 0)
+ LM_ERR("deleting record(s)\n");
+
return(NULL);
}