mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-25 15:08:53 +00:00
Merge "Fix improper usage of scheduler exposed by 5c713fdf18f"
This commit is contained in:
@@ -4322,7 +4322,7 @@ void sip_scheddestroy(struct sip_pvt *p, int ms)
|
|||||||
}
|
}
|
||||||
p->autokillid = ast_sched_add(sched, ms, __sip_autodestruct, dialog_ref(p, "setting ref as passing into ast_sched_add for __sip_autodestruct"));
|
p->autokillid = ast_sched_add(sched, ms, __sip_autodestruct, dialog_ref(p, "setting ref as passing into ast_sched_add for __sip_autodestruct"));
|
||||||
|
|
||||||
if (p->stimer && p->stimer->st_active == TRUE && p->stimer->st_schedid > 0) {
|
if (p->stimer && p->stimer->st_active == TRUE && p->stimer->st_schedid > -1) {
|
||||||
stop_session_timer(p);
|
stop_session_timer(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22743,7 +22743,7 @@ static void check_pendings(struct sip_pvt *p)
|
|||||||
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
|
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
|
||||||
} else if (ast_test_flag(&p->flags[0], SIP_NEEDREINVITE)) {
|
} else if (ast_test_flag(&p->flags[0], SIP_NEEDREINVITE)) {
|
||||||
/* if we can't REINVITE, hold it for later */
|
/* if we can't REINVITE, hold it for later */
|
||||||
if (p->pendinginvite || p->invitestate == INV_CALLING || p->invitestate == INV_PROCEEDING || p->invitestate == INV_EARLY_MEDIA || p->waitid > 0) {
|
if (p->pendinginvite || p->invitestate == INV_CALLING || p->invitestate == INV_PROCEEDING || p->invitestate == INV_EARLY_MEDIA || p->waitid > -1) {
|
||||||
ast_debug(2, "NOT Sending pending reinvite (yet) on '%s'\n", p->callid);
|
ast_debug(2, "NOT Sending pending reinvite (yet) on '%s'\n", p->callid);
|
||||||
} else {
|
} else {
|
||||||
ast_debug(2, "Sending pending reinvite on '%s'\n", p->callid);
|
ast_debug(2, "Sending pending reinvite on '%s'\n", p->callid);
|
||||||
|
@@ -4863,7 +4863,7 @@ static int skinny_dialer_cb(const void *data)
|
|||||||
{
|
{
|
||||||
struct skinny_subchannel *sub = (struct skinny_subchannel *)data;
|
struct skinny_subchannel *sub = (struct skinny_subchannel *)data;
|
||||||
SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Dialer called from SCHED %d\n", sub->callid, sub->dialer_sched);
|
SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Dialer called from SCHED %d\n", sub->callid, sub->dialer_sched);
|
||||||
sub->dialer_sched = 0;
|
sub->dialer_sched = -1;
|
||||||
skinny_dialer(sub, 1);
|
skinny_dialer(sub, 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -4872,7 +4872,7 @@ static int skinny_autoanswer_cb(const void *data)
|
|||||||
{
|
{
|
||||||
struct skinny_subchannel *sub = (struct skinny_subchannel *)data;
|
struct skinny_subchannel *sub = (struct skinny_subchannel *)data;
|
||||||
skinny_locksub(sub);
|
skinny_locksub(sub);
|
||||||
sub->aa_sched = 0;
|
sub->aa_sched = -1;
|
||||||
setsubstate(sub, SKINNY_CONNECTED);
|
setsubstate(sub, SKINNY_CONNECTED);
|
||||||
skinny_unlocksub(sub);
|
skinny_unlocksub(sub);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -4882,7 +4882,7 @@ static int skinny_cfwd_cb(const void *data)
|
|||||||
{
|
{
|
||||||
struct skinny_subchannel *sub = (struct skinny_subchannel *)data;
|
struct skinny_subchannel *sub = (struct skinny_subchannel *)data;
|
||||||
struct skinny_line *l = sub->line;
|
struct skinny_line *l = sub->line;
|
||||||
sub->cfwd_sched = 0;
|
sub->cfwd_sched = -1;
|
||||||
SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - CFWDNOANS to %s.\n", sub->callid, l->call_forward_noanswer);
|
SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - CFWDNOANS to %s.\n", sub->callid, l->call_forward_noanswer);
|
||||||
ast_channel_call_forward_set(sub->owner, l->call_forward_noanswer);
|
ast_channel_call_forward_set(sub->owner, l->call_forward_noanswer);
|
||||||
ast_queue_control(sub->owner, AST_CONTROL_REDIRECTING);
|
ast_queue_control(sub->owner, AST_CONTROL_REDIRECTING);
|
||||||
@@ -4924,7 +4924,7 @@ static int skinny_call(struct ast_channel *ast, const char *dest, int timeout)
|
|||||||
skinny_locksub(sub);
|
skinny_locksub(sub);
|
||||||
AST_LIST_TRAVERSE(ast_channel_varshead(ast), current, entries) {
|
AST_LIST_TRAVERSE(ast_channel_varshead(ast), current, entries) {
|
||||||
if (!(strcmp(ast_var_name(current), "SKINNY_AUTOANSWER"))) {
|
if (!(strcmp(ast_var_name(current), "SKINNY_AUTOANSWER"))) {
|
||||||
if (d->hookstate == SKINNY_ONHOOK && !sub->aa_sched) {
|
if (d->hookstate == SKINNY_ONHOOK && sub->aa_sched < 0) {
|
||||||
char buf[24];
|
char buf[24];
|
||||||
int aatime;
|
int aatime;
|
||||||
char *stringp = buf, *curstr;
|
char *stringp = buf, *curstr;
|
||||||
@@ -5389,9 +5389,9 @@ static struct ast_channel *skinny_new(struct skinny_line *l, struct skinny_subli
|
|||||||
sub->xferor = 0;
|
sub->xferor = 0;
|
||||||
sub->related = NULL;
|
sub->related = NULL;
|
||||||
sub->calldirection = direction;
|
sub->calldirection = direction;
|
||||||
sub->aa_sched = 0;
|
sub->aa_sched = -1;
|
||||||
sub->dialer_sched = 0;
|
sub->dialer_sched = -1;
|
||||||
sub->cfwd_sched = 0;
|
sub->cfwd_sched = -1;
|
||||||
sub->dialType = DIALTYPE_NORMAL;
|
sub->dialType = DIALTYPE_NORMAL;
|
||||||
sub->getforward = 0;
|
sub->getforward = 0;
|
||||||
|
|
||||||
@@ -5550,17 +5550,17 @@ static void setsubstate(struct skinny_subchannel *sub, int state)
|
|||||||
|
|
||||||
if (sub->dialer_sched) {
|
if (sub->dialer_sched) {
|
||||||
skinny_sched_del(sub->dialer_sched, sub);
|
skinny_sched_del(sub->dialer_sched, sub);
|
||||||
sub->dialer_sched = 0;
|
sub->dialer_sched = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state != SUBSTATE_RINGIN && sub->aa_sched) {
|
if (state != SUBSTATE_RINGIN && sub->aa_sched) {
|
||||||
skinny_sched_del(sub->aa_sched, sub);
|
skinny_sched_del(sub->aa_sched, sub);
|
||||||
sub->aa_sched = 0;
|
sub->aa_sched = -1;
|
||||||
sub->aa_beep = 0;
|
sub->aa_beep = 0;
|
||||||
sub->aa_mute = 0;
|
sub->aa_mute = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sub->cfwd_sched) {
|
if (sub->cfwd_sched > -1) {
|
||||||
if (state == SUBSTATE_CONNECTED) {
|
if (state == SUBSTATE_CONNECTED) {
|
||||||
if (skinny_sched_del(sub->cfwd_sched, sub)) {
|
if (skinny_sched_del(sub->cfwd_sched, sub)) {
|
||||||
SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - trying to change state from %s to %s, but already forwarded because no answer.\n",
|
SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - trying to change state from %s to %s, but already forwarded because no answer.\n",
|
||||||
@@ -5568,7 +5568,7 @@ static void setsubstate(struct skinny_subchannel *sub, int state)
|
|||||||
skinny_unlocksub(sub);
|
skinny_unlocksub(sub);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sub->cfwd_sched = 0;
|
sub->cfwd_sched = -1;
|
||||||
} else if (state == SUBSTATE_ONHOOK) {
|
} else if (state == SUBSTATE_ONHOOK) {
|
||||||
skinny_sched_del(sub->cfwd_sched, sub);
|
skinny_sched_del(sub->cfwd_sched, sub);
|
||||||
}
|
}
|
||||||
@@ -6240,7 +6240,7 @@ static int handle_keypad_button_message(struct skinny_req *req, struct skinnyses
|
|||||||
if ((sub->owner && ast_channel_state(sub->owner) < AST_STATE_UP)) {
|
if ((sub->owner && ast_channel_state(sub->owner) < AST_STATE_UP)) {
|
||||||
if (sub->dialer_sched && !skinny_sched_del(sub->dialer_sched, sub)) {
|
if (sub->dialer_sched && !skinny_sched_del(sub->dialer_sched, sub)) {
|
||||||
SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Got a digit and not timed out, so try dialing\n", sub->callid);
|
SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Got a digit and not timed out, so try dialing\n", sub->callid);
|
||||||
sub->dialer_sched = 0;
|
sub->dialer_sched = -1;
|
||||||
len = strlen(sub->exten);
|
len = strlen(sub->exten);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
transmit_stop_tone(d, l->instance, sub->callid);
|
transmit_stop_tone(d, l->instance, sub->callid);
|
||||||
@@ -7077,7 +7077,7 @@ static int handle_soft_key_event_message(struct skinny_req *req, struct skinnyse
|
|||||||
d->name, instance, callreference);
|
d->name, instance, callreference);
|
||||||
if (sub->dialer_sched && !skinny_sched_del(sub->dialer_sched, sub)) {
|
if (sub->dialer_sched && !skinny_sched_del(sub->dialer_sched, sub)) {
|
||||||
size_t len;
|
size_t len;
|
||||||
sub->dialer_sched = 0;
|
sub->dialer_sched = -1;
|
||||||
len = strlen(sub->exten);
|
len = strlen(sub->exten);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
sub->exten[len-1] = '\0';
|
sub->exten[len-1] = '\0';
|
||||||
|
@@ -3311,7 +3311,7 @@ static int ast_rtp_raw_write(struct ast_rtp_instance *instance, struct ast_frame
|
|||||||
rtp->txcount++;
|
rtp->txcount++;
|
||||||
rtp->txoctetcount += (res - hdrlen);
|
rtp->txoctetcount += (res - hdrlen);
|
||||||
|
|
||||||
if (rtp->rtcp && rtp->rtcp->schedid < 1) {
|
if (rtp->rtcp && rtp->rtcp->schedid < 0) {
|
||||||
ast_debug(1, "Starting RTCP transmission on RTP instance '%p'\n", instance);
|
ast_debug(1, "Starting RTCP transmission on RTP instance '%p'\n", instance);
|
||||||
ao2_ref(instance, +1);
|
ao2_ref(instance, +1);
|
||||||
rtp->rtcp->schedid = ast_sched_add(rtp->sched, ast_rtcp_calc_interval(rtp), ast_rtcp_write, instance);
|
rtp->rtcp->schedid = ast_sched_add(rtp->sched, ast_rtcp_calc_interval(rtp), ast_rtcp_write, instance);
|
||||||
@@ -4521,7 +4521,7 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Do not schedule RR if RTCP isn't run */
|
/* Do not schedule RR if RTCP isn't run */
|
||||||
if (rtp->rtcp && !ast_sockaddr_isnull(&rtp->rtcp->them) && rtp->rtcp->schedid < 1) {
|
if (rtp->rtcp && !ast_sockaddr_isnull(&rtp->rtcp->them) && rtp->rtcp->schedid < 0) {
|
||||||
/* Schedule transmission of Receiver Report */
|
/* Schedule transmission of Receiver Report */
|
||||||
ao2_ref(instance, +1);
|
ao2_ref(instance, +1);
|
||||||
rtp->rtcp->schedid = ast_sched_add(rtp->sched, ast_rtcp_calc_interval(rtp), ast_rtcp_write, instance);
|
rtp->rtcp->schedid = ast_sched_add(rtp->sched, ast_rtcp_calc_interval(rtp), ast_rtcp_write, instance);
|
||||||
|
Reference in New Issue
Block a user