[asterisk-commits] twilson: branch 1.6.2 r291904 - /branches/1.6.2/res/res_jabber.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Oct 15 11:17:05 CDT 2010
Author: twilson
Date: Fri Oct 15 11:16:57 2010
New Revision: 291904
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=291904
Log:
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.
Modified:
branches/1.6.2/res/res_jabber.c
Modified: branches/1.6.2/res/res_jabber.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/res/res_jabber.c?view=diff&rev=291904&r1=291903&r2=291904
==============================================================================
--- branches/1.6.2/res/res_jabber.c (original)
+++ branches/1.6.2/res/res_jabber.c Fri Oct 15 11:16:57 2010
@@ -3061,12 +3061,12 @@
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;
+ ASTOBJ_UNLOCK(iterator);
+ pthread_join(iterator->thread, NULL);
ast_aji_disconnect(iterator);
- pthread_join(iterator->thread, NULL);
- ASTOBJ_UNLOCK(iterator);
});
ASTOBJ_CONTAINER_DESTROYALL(&clients, aji_client_destroy);
More information about the asterisk-commits
mailing list