Module: sip-router Branch: 3.1 Commit: d5e90ab587746a39c9be44d9f9f1c325b8d4902d URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d5e90ab5...
Author: Timo Reimann timo.reimann@1und1.de Committer: Timo Reimann timo.reimann@1und1.de Date: Sat Aug 27 01:44:03 2011 +0200
modules_k/dialog: Improve error handling during dialog creation.
- Set current dialog only after all other setup work succeeded. (Eliminates call to profile_cleanup() and guarantees that dialog profiling does not yield to segfault if dialog creation fails for certain reasons.) - During error handling, refrain from decrementing the reference counter for dialog linking if this is a spiraled request (because positive spiral detection skips the linkage code path). (cherry picked from commit 71dd754818d8c3ec304298f1002a45889c2da0aa)
Conflicts:
modules_k/dialog/dlg_handlers.c
---
modules_k/dialog/dlg_handlers.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/modules_k/dialog/dlg_handlers.c b/modules_k/dialog/dlg_handlers.c index 16eda6c..3500fad 100644 --- a/modules_k/dialog/dlg_handlers.c +++ b/modules_k/dialog/dlg_handlers.c @@ -757,10 +757,6 @@ int dlg_new_dialog(struct sip_msg *msg, struct cell *t) if_update_stat( dlg_enable_stats, processed_dlgs, 1);
finish: - set_current_dialog(msg, dlg); - _dlg_ctx.dlg = dlg; - ref_dlg(dlg, 1); - if (t) { // transaction exists ==> keep ref counter large enough to // avoid premature cleanup and ensure proper dialog referencing @@ -779,10 +775,15 @@ finish: } }
+ set_current_dialog(req, dlg); + _dlg_ctx.dlg = dlg; + ref_dlg(dlg, 1); + return 0; + error: - unref_dlg(dlg,1); // undo ref regarding linking - profile_cleanup(msg, 0, NULL); // undo ref regarding setting current dialog + if (!spiral_detected) + unref_dlg(dlg,1); // undo ref regarding linking return -1; }