Hello,
I'm currently debugging a segfault in the presence module, which is
caused by it recursively calling srdb1 functions on the same db handle,
which at least under db_mysql doesn't work and causes segfault. I was
wondering what the preferred fix would be: Fix presence module so it
doesn't do that, or fix db_mysql so that recursive queries are possible.
Personally I'd prefer the second option, but AFAICS it would require
some changes to srdb1 itself. Any other options I'm not seeing?
cheers
Module: sip-router
Branch: master
Commit: 8366a26fb8e3c6d5815cd4cd5bde48575e9f6b71
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8366a26…
Author: Richard Fuchs <rfuchs(a)sipwise.com>
Committer: Richard Fuchs <rfuchs(a)sipwise.com>
Date: Wed Apr 10 09:33:53 2013 -0400
srdb1: add new db-private generic pointer to struct db1_res
---
lib/srdb1/db_res.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/lib/srdb1/db_res.h b/lib/srdb1/db_res.h
index f8f909f..62fc11c 100644
--- a/lib/srdb1/db_res.h
+++ b/lib/srdb1/db_res.h
@@ -61,6 +61,7 @@ typedef struct db1_res {
int n; /**< Number of rows in current fetch */
int res_rows; /**< Number of total rows in query */
int last_row; /**< Last row */
+ void* ptr; /**< For use by DB modules */
} db1_res_t;
@@ -78,6 +79,8 @@ typedef struct db1_res {
#define RES_LAST_ROW(re) ((re)->last_row)
/** Return the number of total result rows */
#define RES_NUM_ROWS(re) ((re)->res_rows)
+/** Return the module-specific pointer */
+#define RES_PTR(re) ((re)->ptr)
/**
i added possibility to call t_branch_timeout() and t_branch_replied()
from branch-failure event route. i tested the possible result
combinations and they seemed to work ok.
however, during the tests is turned out that they don't help when it
comes to unregistering unresponsive contacts in case the contacts are
directly connected and set_forward_no_connect() is called before
t_relay(). the reason is that in that case, failure route or branch
failure route is not executed at all.
-- juha