diff options
author | Joshua Colp <jcolp@digium.com> | 2006-12-15 19:40:29 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2006-12-15 19:40:29 +0000 |
commit | 6bdd1a3388db82f271fadbcadb422c3175ca45b4 (patch) | |
tree | a8bcc8748785a5d59861c77803b0dbee44c0c0ff | |
parent | 12565be69eeb4d33eed6f3c08598264e6a232e61 (diff) |
Merged revisions 48504 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r48504 | file | 2006-12-15 14:38:51 -0500 (Fri, 15 Dec 2006) | 2 lines
Hold call structure lock in places where a qualify or peer action can destroy it.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48505 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | channels/chan_iax2.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index f2661426c..16f2765c3 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -7752,7 +7752,9 @@ static int iax2_do_register(struct iax2_registry *reg) * call has the pointer to IP and must be updated to the new one */ if (reg->dnsmgr && ast_dnsmgr_changed(reg->dnsmgr) && (reg->callno > 0)) { + ast_mutex_lock(&iaxsl[reg->callno]); iax2_destroy(reg->callno); + ast_mutex_unlock(&iaxsl[reg->callno]); reg->callno = 0; } if (!reg->addr.sin_addr.s_addr) { @@ -7919,8 +7921,11 @@ static void __iax2_poke_noanswer(void *data) manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: IAX2/%s\r\nPeerStatus: Unreachable\r\nTime: %d\r\n", peer->name, peer->lastms); ast_device_state_changed("IAX2/%s", peer->name); /* Activate notification */ } - if (peer->callno > 0) + if (peer->callno > 0) { + ast_mutex_lock(&iaxsl[peer->callno]); iax2_destroy(peer->callno); + ast_mutex_unlock(&iaxsl[peer->callno]); + } peer->callno = 0; peer->lastms = -1; /* Try again quickly */ @@ -7951,7 +7956,9 @@ static int iax2_poke_peer(struct iax2_peer *peer, int heldcall) } if (peer->callno > 0) { ast_log(LOG_NOTICE, "Still have a callno...\n"); + ast_mutex_lock(&iaxsl[peer->callno]); iax2_destroy(peer->callno); + ast_mutex_unlock(&iaxsl[peer->callno]); } if (heldcall) ast_mutex_unlock(&iaxsl[heldcall]); @@ -8786,8 +8793,11 @@ static void destroy_peer(struct iax2_peer *peer) ast_sched_del(sched, peer->expire); if (peer->pokeexpire > -1) ast_sched_del(sched, peer->pokeexpire); - if (peer->callno > 0) + if (peer->callno > 0) { + ast_mutex_lock(&iaxsl[peer->callno]); iax2_destroy(peer->callno); + ast_mutex_unlock(&iaxsl[peer->callno]); + } register_peer_exten(peer, 0); |