Module: sip-router
Branch: master
Commit: c125cf6f36aedb75b4f1e0b32dbe5bdd0a48b8b5
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c125cf6f36aedb75b4f1e0b32dbe5bdd0a48b8b5

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date:   Thu Aug 14 14:59:09 2014 +0200

dialog: release of dialog for not-forwarded initial request done by creator

- avoid releasing new dialog in case of upstream paralel forking
  or retransmission by other processes than the other which created the
  dialog
- it could result in destroying the dialog in initial state if the
  request was not forwarded yet, likely to happen because creator
  process runs more callbacks

---

 modules/dialog/dlg_handlers.c |    2 ++
 modules/dialog/dlg_var.c      |    9 +++++++--
 modules/dialog/dlg_var.h      |    1 +
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c
index 947bd5b..a0daa39 100644
--- a/modules/dialog/dlg_handlers.c
+++ b/modules/dialog/dlg_handlers.c
@@ -58,6 +58,7 @@
 #include "../../lib/kcore/statistics.h"
 #include "../../action.h"
 #include "../../script_cb.h"
+#include "../../pt.h"
 #include "../../lib/kcore/faked_msg.h"
 #include "../../parser/parse_from.h"
 #include "../../parser/parse_cseq.h"
@@ -874,6 +875,7 @@ int dlg_new_dialog(sip_msg_t *req, struct cell *t, const 
int run_initial_cbs)
 
     if_update_stat( dlg_enable_stats, processed_dlgs, 1);
 
+       _dlg_ctx.cpid = my_pid();
 finish:
     _dlg_ctx.iuid.h_entry = dlg->h_entry;
     _dlg_ctx.iuid.h_id = dlg->h_id;
diff --git a/modules/dialog/dlg_var.c b/modules/dialog/dlg_var.c
index e90dfc5..8badd58 100644
--- a/modules/dialog/dlg_var.c
+++ b/modules/dialog/dlg_var.c
@@ -46,9 +46,14 @@ int dlg_cfg_cb(sip_msg_t *msg, unsigned int flags, void *cbp)
                dlg = dlg_get_ctx_dialog();
                if(dlg!=NULL) {
                        if(_dlg_ctx.t==0 && dlg->state==DLG_STATE_UNCONFIRMED) {
-                               LM_DBG("new dialog with no trasaction after 
config execution\n");
-                               dlg_release(dlg);
+                               if(_dlg_ctx.cpid!=0 && _dlg_ctx.cpid==my_pid()) 
{
+                                       /* release to destroy dialog if created 
by this process
+                                        * and request was not forwarded */
+                                       LM_DBG("new dialog with no trasaction 
after config execution\n");
+                                       dlg_release(dlg);
+                               }
                        }
+                       /* get ctx dlg increased ref count - release now */
                        dlg_release(dlg);
                }
        }
diff --git a/modules/dialog/dlg_var.h b/modules/dialog/dlg_var.h
index e9f08c8..bb604b7 100644
--- a/modules/dialog/dlg_var.h
+++ b/modules/dialog/dlg_var.h
@@ -39,6 +39,7 @@ typedef struct _dlg_ctx {
        int timeout;
        dlg_cell_t *dlg1;
        dlg_iuid_t iuid;
+       int cpid;
        int set;
        unsigned int dir;
        int t;


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to