diff options
author | pcadach <pcadach@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-09-25 20:28:21 +0000 |
---|---|---|
committer | pcadach <pcadach@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-09-25 20:28:21 +0000 |
commit | b4084dbed600221e0a9f67126630e61e37d71c70 (patch) | |
tree | 0cf49c32cfe680cb18bbf8b94f9671894711e5ad /channels/chan_h323.c | |
parent | 8596c6971c2a26b3892048dd537c0249005be8e7 (diff) |
Backport changes of trunk:
1) r43540: Avoid possible deadlock on channel destruction
2) r43590: Disable fastStart if requested by remote side
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@43626 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_h323.c')
-rw-r--r-- | channels/chan_h323.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/channels/chan_h323.c b/channels/chan_h323.c index f60da0fe8..f147cfe69 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -2442,34 +2442,36 @@ static void *do_monitor(void *data) h323_do_reload(); } /* Check for interfaces needing to be killed */ - ast_mutex_lock(&iflock); + if (!ast_mutex_trylock(&iflock)) { #if 1 - do { - for (oh323 = iflist; oh323; oh323 = oh323->next) { + do { + for (oh323 = iflist; oh323; oh323 = oh323->next) { + if (!ast_mutex_trylock(&oh323->lock)) { + if (oh323->needdestroy) { + __oh323_destroy(oh323); + break; + } + ast_mutex_unlock(&oh323->lock); + } + } + } while (/*oh323*/ 0); +#else +restartsearch: + oh323 = iflist; + while(oh323) { if (!ast_mutex_trylock(&oh323->lock)) { if (oh323->needdestroy) { __oh323_destroy(oh323); - break; + goto restartsearch; } ast_mutex_unlock(&oh323->lock); + oh323 = oh323->next; } } - } while (/*oh323*/ 0); -#else -restartsearch: - oh323 = iflist; - while(oh323) { - if (!ast_mutex_trylock(&oh323->lock)) { - if (oh323->needdestroy) { - __oh323_destroy(oh323); - goto restartsearch; - } - ast_mutex_unlock(&oh323->lock); - oh323 = oh323->next; - } - } #endif - ast_mutex_unlock(&iflock); + ast_mutex_unlock(&iflock); + } else + oh323 = (struct oh323_pvt *)1; /* Force fast loop */ pthread_testcancel(); /* Wait for sched or io */ res = ast_sched_wait(sched); |