It also required deadlock avoidance since two sip_pvts structs needed to be
locked simultaneously. Trunk handles it differently, so this is a 1.8 and 10
patch only.
........
(issue AST-876)
Merged revisions 366791 from http://svn.asterisk.org/svn/asterisk/branches/1.8
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@366792
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
}
sip_pvt_lock(p);
+ while (sip_pvt_trylock(opp)) {
+ sip_pvt_unlock(p);
+ usleep(1);
+ sip_pvt_lock(p);
+ }
+
if (p->udptl && ast_test_flag(&p->flags[0], SIP_DIRECT_MEDIA)) {
if (apply_directmedia_ha(p, opp, "UDPTL T.38 data")) {
udptl = p->udptl;
}
}
+
+ sip_pvt_unlock(opp);
sip_pvt_unlock(p);
return udptl;
}
}
sip_pvt_lock(p);
+ while (sip_pvt_trylock(opp)) {
+ sip_pvt_unlock(p);
+ usleep(1);
+ sip_pvt_lock(p);
+ }
+
if (!(p->rtp)) {
+ sip_pvt_unlock(opp);
sip_pvt_unlock(p);
return AST_RTP_GLUE_RESULT_FORBID;
}
res = AST_RTP_GLUE_RESULT_FORBID;
}
+ sip_pvt_unlock(opp);
+
if (p->srtp) {
res = AST_RTP_GLUE_RESULT_FORBID;
}
}
sip_pvt_lock(p);
+ while (sip_pvt_trylock(opp)) {
+ sip_pvt_unlock(p);
+ usleep(1);
+ sip_pvt_lock(p);
+ }
+
if (!(p->vrtp)) {
+ sip_pvt_unlock(opp);
sip_pvt_unlock(p);
return AST_RTP_GLUE_RESULT_FORBID;
}
}
}
+ sip_pvt_unlock(opp);
sip_pvt_unlock(p);
return res;
}
sip_pvt_lock(p);
+ while (sip_pvt_trylock(opp)) {
+ sip_pvt_unlock(p);
+ usleep(1);
+ sip_pvt_lock(p);
+ }
+
if (!(p->trtp)) {
+ sip_pvt_unlock(opp);
sip_pvt_unlock(p);
return AST_RTP_GLUE_RESULT_FORBID;
}
}
}
+ sip_pvt_unlock(opp);
sip_pvt_unlock(p);
return res;