Module: sip-router Branch: 3.3 Commit: 9de930d083af681fc85fc4cee90dfadbbaadb89c URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9de930d0...
Author: Peter Dunkley peter.dunkley@crocodile-rcs.com Committer: Peter Dunkley peter.dunkley@crocodile-rcs.com Date: Tue Aug 21 15:21:03 2012 +0100
modules_k/pua: transaction not ended before calling send_publish() from TM call-back
- Found by Hugh Waite @ Crocodile RCS and fixed by Peter Dunkley @ Crocodile RCS (cherry picked from commit b9e77beaee850303ffa736cb4043d21a1806fa4f)
---
modules_k/pua/send_publish.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/modules_k/pua/send_publish.c b/modules_k/pua/send_publish.c index 3bc8702..97935c1 100644 --- a/modules_k/pua/send_publish.c +++ b/modules_k/pua/send_publish.c @@ -207,6 +207,7 @@ void publ_cback_func(struct cell *t, int type, struct tmcb_params *ps) db1_res_t *res=NULL; ua_pres_t dbpres; str pres_uri={0,0}, watcher_uri={0,0}, extra_headers={0,0}; + int end_transaction = 1;
memset(&dbpres, 0, sizeof(dbpres)); dbpres.pres_uri = &pres_uri; @@ -275,6 +276,17 @@ void publ_cback_func(struct cell *t, int type, struct tmcb_params *ps) publ.extra_headers= hentity->extra_headers; publ.cb_param= hentity->cb_param;
+ if (dbmode == PUA_DB_ONLY && pua_dbf.end_transaction) + { + if (pua_dbf.end_transaction(pua_db) < 0) + { + LM_ERR("in end_transaction\n"); + goto error; + } + } + + end_transaction = 0; + if(send_publish(&publ)< 0) { LM_ERR("when trying to send PUBLISH\n"); @@ -432,7 +444,7 @@ done:
if (res) free_results_puadb(res);
- if (dbmode == PUA_DB_ONLY && pua_dbf.end_transaction) + if (dbmode == PUA_DB_ONLY && pua_dbf.end_transaction && end_transaction) { if (pua_dbf.end_transaction(pua_db) < 0) {