[asterisk-commits] dvossel: branch dvossel/masq_locking_order_trunk r221591 - in /team/dvossel/m...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 1 10:56:38 CDT 2009
Author: dvossel
Date: Thu Oct 1 10:56:34 2009
New Revision: 221591
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=221591
Log:
minor code and comment style cleanup.
Modified:
team/dvossel/masq_locking_order_trunk/channels/chan_sip.c
team/dvossel/masq_locking_order_trunk/main/channel.c
Modified: team/dvossel/masq_locking_order_trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/masq_locking_order_trunk/channels/chan_sip.c?view=diff&rev=221591&r1=221590&r2=221591
==============================================================================
--- team/dvossel/masq_locking_order_trunk/channels/chan_sip.c (original)
+++ team/dvossel/masq_locking_order_trunk/channels/chan_sip.c Thu Oct 1 10:56:34 2009
@@ -19647,8 +19647,11 @@
XXX 'ignore' is unused.
\note this function is called by handle_request_invite(). Four locks
- held at the beginning of this function, p, p->owner, p->refer->refer_call->owner...
- only p's lock should remain at the end of this function. p's lock is held by sipsock_read()
+ held at the beginning of this function, p, p->owner, p->refer->refer_call and
+ p->refere->refer_call->owner. only p's lock should remain at the end of this
+ function. p's lock as well as the channel p->owner's lock are held by
+ handle_request_do(), we unlock p->owner before the masq. By setting nounlock
+ we are indicating to handle_request_do() that we have already unlocked the owner.
*/
static int handle_invite_replaces(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *nounlock)
{
@@ -20893,8 +20896,7 @@
* pointers that were locked to begin with.
*
* If this function is successful, only the transferer pvt lock will remain on return. Setting nounlock indicates
- * to socket_read that the pvt's owner it locked does not require an unlock... This is very important to take care of
- * before a masqurade as the owner channel socket_read locks will probably not be the one it trys to unlock.
+ * to handle_request_do() that the pvt's owner it locked does not require an unlock.
*/
static int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual *current, struct sip_request *req, int seqno, int *nounlock)
{
Modified: team/dvossel/masq_locking_order_trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/masq_locking_order_trunk/main/channel.c?view=diff&rev=221591&r1=221590&r2=221591
==============================================================================
--- team/dvossel/masq_locking_order_trunk/main/channel.c (original)
+++ team/dvossel/masq_locking_order_trunk/main/channel.c Thu Oct 1 10:56:34 2009
@@ -3069,7 +3069,7 @@
int count = 0, cause = 0;
/* this function is very long so make sure there is only one return
- * point at the end (there are only three exceptions to this).
+ * point at the end (there are only two exceptions to this).
*/
if (chan->masq) {
@@ -3080,12 +3080,8 @@
return f;
}
- while(ast_channel_trylock(chan)) {
- if(count++ > 10)
- /*cannot goto done since the channel is not locked*/
- return &ast_null_frame;
- usleep(1);
- }
+ /* if here, no masq has happened, lock the channel and proceed */
+ ast_channel_lock(chan);
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
@@ -5364,8 +5360,7 @@
clonechan->hangupcause,
ast_cause2str(clonechan->hangupcause)
);
- ast_channel_release(clonechan);
- clonechan = NULL;
+ clonechan = ast_channel_release(clonechan);
} else {
ast_debug(1, "Released clone lock on '%s'\n", clonechan->name);
ast_set_flag(clonechan, AST_FLAG_ZOMBIE);
More information about the asterisk-commits
mailing list