return this logic to where it used to be, *after* the dialog->needdestroy flag has been determined to be set; otherwise, we generate these debug messages every time we inspect every active dialog

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@149981 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.2
Kevin P. Fleming 17 years ago
parent 1e56eb7e87
commit 4ca2b3836a

@ -13104,6 +13104,7 @@ static int dialog_needdestroy(void *dialogobj, void *arg, int flags)
time_t *t = arg; time_t *t = arg;
/* log_show_lock(ao2_object_get_lockaddr(dialog)); this is an example of how to use log_show_lock() */ /* log_show_lock(ao2_object_get_lockaddr(dialog)); this is an example of how to use log_show_lock() */
if (sip_pvt_trylock(dialog)) { if (sip_pvt_trylock(dialog)) {
/* In very short-duration calls via sipp, /* In very short-duration calls via sipp,
this path gets executed fairly frequently (3% or so) even in low load this path gets executed fairly frequently (3% or so) even in low load
@ -13114,6 +13115,7 @@ static int dialog_needdestroy(void *dialogobj, void *arg, int flags)
ao2_unlock(dialogs); ao2_unlock(dialogs);
usleep(1); usleep(1);
ao2_lock(dialogs); ao2_lock(dialogs);
/* I had previously returned CMP_STOP here; but changed it to return /* I had previously returned CMP_STOP here; but changed it to return
a zero instead, because there is no need to stop at the first sign a zero instead, because there is no need to stop at the first sign
of trouble. The old algorithm would restart in such circumstances, of trouble. The old algorithm would restart in such circumstances,
@ -13126,18 +13128,6 @@ static int dialog_needdestroy(void *dialogobj, void *arg, int flags)
return 0; return 0;
} }
/* We absolutely cannot destroy the rtp struct while a bridge is active or we WILL crash */
if (dialog->rtp && ast_rtp_get_bridged(dialog->rtp)) {
ast_debug(2, "Bridge still active. Delaying destruction of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
sip_pvt_unlock(dialog);
return 0;
}
if (dialog->vrtp && ast_rtp_get_bridged(dialog->vrtp)) {
ast_debug(2, "Bridge still active. Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
sip_pvt_unlock(dialog);
return 0;
}
/* Check RTP timeouts and kill calls if we have a timeout set and do not get RTP */ /* Check RTP timeouts and kill calls if we have a timeout set and do not get RTP */
check_rtp_timeout(dialog, *t); check_rtp_timeout(dialog, *t);
@ -13145,13 +13135,28 @@ static int dialog_needdestroy(void *dialogobj, void *arg, int flags)
/* Check if we have outstanding requests not responsed to or an active call /* Check if we have outstanding requests not responsed to or an active call
- if that's the case, wait with destruction */ - if that's the case, wait with destruction */
if (dialog->needdestroy && !dialog->packets && !dialog->owner) { if (dialog->needdestroy && !dialog->packets && !dialog->owner) {
/* We absolutely cannot destroy the rtp struct while a bridge is active or we WILL crash */
if (dialog->rtp && ast_rtp_get_bridged(dialog->rtp)) {
ast_debug(2, "Bridge still active. Delaying destruction of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
sip_pvt_unlock(dialog);
return 0;
}
if (dialog->vrtp && ast_rtp_get_bridged(dialog->vrtp)) {
ast_debug(2, "Bridge still active. Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
sip_pvt_unlock(dialog);
return 0;
}
sip_pvt_unlock(dialog); sip_pvt_unlock(dialog);
/* no, the unlink should handle this: dialog_unref(dialog, "needdestroy: one more refcount decrement to allow dialog to be destroyed"); */ /* no, the unlink should handle this: dialog_unref(dialog, "needdestroy: one more refcount decrement to allow dialog to be destroyed"); */
/* the CMP_MATCH will unlink this dialog from the dialog hash table */ /* the CMP_MATCH will unlink this dialog from the dialog hash table */
dialog_unlink_all(dialog, TRUE, FALSE); dialog_unlink_all(dialog, TRUE, FALSE);
return 0; /* the unlink_all should unlink this from the table, so.... no need to return a match */ return 0; /* the unlink_all should unlink this from the table, so.... no need to return a match */
} }
sip_pvt_unlock(dialog); sip_pvt_unlock(dialog);
return 0; return 0;
} }

Loading…
Cancel
Save