This patch is part of a series to resolve deadlocks in chan_sip.c.
* Make dialog_unlink_all() unschedule all items at once in the sched
thread.
ASTERISK-25023
Change-Id: I7743072fb228836e8228b72f6dc46c8cc50b3fb4
dialog->relatedpeer->call=dialog_unref(dialog->relatedpeer->call,"unset the relatedpeer->call field in tandem with relatedpeer field itself");
}
/* remove all current packets in this dialog */
while((cp=dialog->packets)){
dialog->packets=dialog->packets->next;
AST_SCHED_DEL(sched,cp->retransid);
dialog_unref(cp->owner,"remove all current packets in this dialog, and the pointer to the dialog too as part of __sip_destroy");
if(cp->data){
ast_free(cp->data);
}
ast_free(cp);
}
AST_SCHED_DEL_UNREF(sched,dialog->waitid,dialog_unref(dialog,"when you delete the waitid sched, you should dec the refcount for the stored dialog ptr"));
AST_SCHED_DEL_UNREF(sched,dialog->initid,dialog_unref(dialog,"when you delete the initid sched, you should dec the refcount for the stored dialog ptr"));
if(dialog->reinviteid>-1){
AST_SCHED_DEL_UNREF(sched,dialog->reinviteid,dialog_unref(dialog,"clear ref for reinvite_timeout"));
}
if(dialog->autokillid>-1){
AST_SCHED_DEL_UNREF(sched,dialog->autokillid,dialog_unref(dialog,"when you delete the autokillid sched, you should dec the refcount for the stored dialog ptr"));
}
if(dialog->request_queue_sched_id>-1){
AST_SCHED_DEL_UNREF(sched,dialog->request_queue_sched_id,dialog_unref(dialog,"when you delete the request_queue_sched_id sched, you should dec the refcount for the stored dialog ptr"));
}
AST_SCHED_DEL_UNREF(sched,dialog->provisional_keepalive_sched_id,dialog_unref(dialog,"when you delete the provisional_keepalive_sched_id, you should dec the refcount for the stored dialog ptr"));
if(dialog->t38id>-1){
AST_SCHED_DEL_UNREF(sched,dialog->t38id,dialog_unref(dialog,"when you delete the t38id sched, you should dec the refcount for the stored dialog ptr"));
}
if(dialog->stimer){
stop_session_timer(dialog);
dialog_ref(dialog,"Stop scheduled items for unlink action");