diff options
author | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-10-15 16:16:57 +0000 |
---|---|---|
committer | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-10-15 16:16:57 +0000 |
commit | 8ae20dcd9d40b90cf1830b1d75d0286cfa9c9ca0 (patch) | |
tree | c1d40ebcbab5f0320a961d3d639ff894477bde3e /res | |
parent | 71591c00cc4b1619f2a337c77c11dcb41b72b69e (diff) |
Don't crash or deadlock on module unload
We can't hold the lock while pthread_join is called since aji_log_hook will
attempt to lock from the other therad. We reorder the pthread_join and
ast_aji_disconnect so that we don't do an SSL_read() while SSL_shutdown is
running, causing a crash.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@291904 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_jabber.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/res/res_jabber.c b/res/res_jabber.c index dbbeab95c..e4bdacc78 100644 --- a/res/res_jabber.c +++ b/res/res_jabber.c @@ -3061,12 +3061,12 @@ static int unload_module(void) ast_custom_function_unregister(&jabberstatus_function); ASTOBJ_CONTAINER_TRAVERSE(&clients, 1, { - ASTOBJ_RDLOCK(iterator); + ASTOBJ_WRLOCK(iterator); ast_debug(3, "JABBER: Releasing and disconnecting client: %s\n", iterator->name); iterator->state = AJI_DISCONNECTING; - ast_aji_disconnect(iterator); - pthread_join(iterator->thread, NULL); ASTOBJ_UNLOCK(iterator); + pthread_join(iterator->thread, NULL); + ast_aji_disconnect(iterator); }); ASTOBJ_CONTAINER_DESTROYALL(&clients, aji_client_destroy); |