[asterisk-dev] mmichelson: trunk r157427 - /trunk/channels/chan_sip.c

Mark Michelson mmichelson at digium.com
Tue Nov 18 15:36:16 CST 2008


Russell Bryant wrote:
> Mark Michelson wrote:
>> Russell Bryant wrote:
>>> SVN commits to the Digium repositories wrote:
> 
>>>> +/*! \brief Protect the callcounters inuse,inringing and the corresponding flags */
>>>> +AST_MUTEX_DEFINE_STATIC(callctrlock);
>>>> +
>>> What is the logic behind using this new global lock for this purpose? 
>>> What is wrong with just ensuring that the sip_pvt is locked during these 
>>> operations?
>>>
>> The reason is that we are protecting boht flags that are in the sip_pvt 
>> structure and more importantly counters that are in the sip_peer structure (and 
>> in the case of 1.6.0, the sip_user structure, too). Because sip_peers and 
>> sip_pvts do not necessarily share a 1:1 relationship, the data in the sip_peer 
>> is not sufficiently protected by just locking the sip_pvt.
> 
> Ok, then it seems like the right thing is to have the sip_pvt and the 
> sip_peer locked, then.
> 

I thought about doing that, too, but I couldn't really see any added value in 
adding a lock to the sip_peer structure over the solution that was presented in 
the provided patch. I suppose that since we are protecting data that is part of 
the sip_peer structure, it makes sense to add locks to the sip_peer and sip_user 
structures. I'll go ahead and make these changes.

Mark Michelson



More information about the asterisk-dev mailing list