summaryrefslogtreecommitdiff
path: root/pjlib-util/src
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2010-08-27 03:19:00 +0000
committerBenny Prijono <bennylp@teluu.com>2010-08-27 03:19:00 +0000
commit41b2998504157f24d6b991d372e77addbed55030 (patch)
treed7fe8bd892ecafe9896ad54831287d8b8d5275dc /pjlib-util/src
parentb531de656e99f69105ac95f5a7b4acf5e5101a8e (diff)
Fixed #1108: deadlock in DNS resolver (thanks Bogdan Krakowski for the report)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3298 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib-util/src')
-rw-r--r--pjlib-util/src/pjlib-util/resolver.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pjlib-util/src/pjlib-util/resolver.c b/pjlib-util/src/pjlib-util/resolver.c
index ee0b9e78..6da22c50 100644
--- a/pjlib-util/src/pjlib-util/resolver.c
+++ b/pjlib-util/src/pjlib-util/resolver.c
@@ -1364,6 +1364,9 @@ static void on_read_complete(pj_ioqueue_key_t *key,
pj_hash_set(NULL, resolver->hquerybyid, &q->id, sizeof(q->id), 0, NULL);
pj_hash_set(NULL, resolver->hquerybyres, &q->key, sizeof(q->key), 0, NULL);
+ /* Workaround for deadlock problem in #1108 */
+ pj_mutex_unlock(resolver->mutex);
+
/* Notify applications first, to allow application to modify the
* record before it is saved to the hash table.
*/
@@ -1382,6 +1385,9 @@ static void on_read_complete(pj_ioqueue_key_t *key,
}
}
+ /* Workaround for deadlock problem in #1108 */
+ pj_mutex_lock(resolver->mutex);
+
/* Save/update response cache. */
update_res_cache(resolver, &q->key, status, PJ_TRUE, dns_pkt);