[asterisk-dev] externaddr in chan_sip.c - locking required?
Ian Pilcher
arequipeno at gmail.com
Tue Nov 1 10:12:05 CDT 2011
This is a follow-up to my "STUN support idea" thread.
I have reached the point in my effort of actually updating the value of
externaddr when a AST_EVENT_NETWORK_CHANGE event occurs, so I'm trying
to understand how this variable is (or is not) accessed by multiple
threads.
Here's what I've been able to determine:
* externaddr is set in reload_config().
* externaddr is read in sip_show_settings().
* externaddr is both read and written in ast_sip_ouraddrfor().
None of these access use any locking, which seems wrong to me --
assuming that ast_sip_ouraddrfor() is supposed to be thread-safe.
Is my analysis correct? If so, I would propose to protect accesses to
externaddr with a read/write lock, since changes should be infrequent.
Please let me know.
Thanks!
--
========================================================================
Ian Pilcher arequipeno at gmail.com
"If you're going to shift my paradigm ... at least buy me dinner first."
========================================================================
More information about the asterisk-dev
mailing list