[asterisk-commits] tilghman: branch 1.6.0 r236805 - in /branches/1.6.0: ./ channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Dec 29 17:11:03 CST 2009
Author: tilghman
Date: Tue Dec 29 17:11:00 2009
New Revision: 236805
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=236805
Log:
Merged revisions 236802 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r236802 | tilghman | 2009-12-29 17:05:45 -0600 (Tue, 29 Dec 2009) | 7 lines
Shut down the SIP session timers more gracefully, in order to prevent a possible crash.
(closes issue #16452)
Reported by: corruptor
Patches:
20091221__issue16452.diff.txt uploaded by tilghman (license 14)
Tested by: corruptor
........
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/channels/chan_sip.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/channels/chan_sip.c?view=diff&rev=236805&r1=236804&r2=236805
==============================================================================
--- branches/1.6.0/channels/chan_sip.c (original)
+++ branches/1.6.0/channels/chan_sip.c Tue Dec 29 17:11:00 2009
@@ -1128,6 +1128,7 @@
int st_cached_max_se; /*!< Session-Timers cached Session-Expires */
enum st_mode st_cached_mode; /*!< Session-Timers cached M.O. */
enum st_refresher st_cached_ref; /*!< Session-Timers cached refresher */
+ unsigned char quit_flag:1; /*!< Stop trying to lock; just quit */
};
@@ -2412,10 +2413,10 @@
/* Destroy Session-Timers if allocated */
if (p->stimer) {
+ p->stimer->quit_flag = 1;
if (p->stimer->st_active == TRUE && p->stimer->st_schedid > -1) {
- AST_SCHED_DEL_UNREF(sched, p->stimer->st_schedid, dialog_unref(p));
- }
- ast_free(p->stimer);
+ AST_SCHED_DEL_UNREF(sched, p->stimer->st_schedid, if (_count < 10) dialog_unref(p));
+ }
}
/* this is the last dialog ref */
dialog_unref(p);
@@ -4642,6 +4643,11 @@
{
struct sip_pkt *cp;
struct sip_request *req;
+
+ if (p->stimer) {
+ ast_free(p->stimer);
+ p->stimer = NULL;
+ }
if (sip_debug_test_pvt(p))
ast_verbose("Really destroying SIP dialog '%s' Method: %s\n", p->callid, sip_methods[p->method].text);
@@ -20352,22 +20358,32 @@
} else {
p->stimer->st_expirys++;
if (p->stimer->st_expirys >= 2) {
+ if (p->stimer->quit_flag) {
+ goto return_unref;
+ }
ast_log(LOG_WARNING, "Session-Timer expired - %s\n", p->callid);
+ sip_pvt_lock(p);
while (p->owner && ast_channel_trylock(p->owner)) {
sip_pvt_unlock(p);
usleep(1);
+ if (p->stimer && p->stimer->quit_flag) {
+ goto return_unref;
+ }
sip_pvt_lock(p);
}
ast_softhangup_nolock(p->owner, AST_SOFTHANGUP_DEV);
ast_channel_unlock(p->owner);
+ sip_pvt_unlock(p);
}
}
return_unref:
if (!res) {
/* An error occurred. Stop session timer processing */
- p->stimer->st_schedid = -1; /* this is the sched, so this is safe */
- stop_session_timer(p); /* will not unref, only mark st_active FALSE */
+ if (p->stimer) {
+ p->stimer->st_schedid = -1; /* this is the sched, so this is safe */
+ stop_session_timer(p); /* will not unref, only mark st_active FALSE */
+ }
/* If we are not asking to be rescheduled, then we need to release our
* reference to the dialog. */
More information about the asterisk-commits
mailing list