[asterisk-addons-commits] mnicholson: branch mnicholson/chan-mobile-refactor r808 - /team/mnicholson/ch...

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Fri Mar 13 15:18:44 CDT 2009


Author: mnicholson
Date: Fri Mar 13 15:18:41 2009
New Revision: 808

URL: http://svn.digium.com/svn-view/asterisk-addons?view=rev&rev=808
Log:
hangup owner on hsp disconnect and lock the pvt during clean up

Modified:
    team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c

Modified: team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c
URL: http://svn.digium.com/svn-view/asterisk-addons/team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c?view=diff&rev=808&r1=807&r2=808
==============================================================================
--- team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c (original)
+++ team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c Fri Mar 13 15:18:41 2009
@@ -3423,16 +3423,24 @@
 	if (io)
 		io_context_destroy(io);
 
+	ast_mutex_lock(&pvt->lock);
+	if (pvt->owner) {
+		ast_debug(1, "[%s] device disconnected, hanging up owner\n", pvt->id);
+		ast_queue_hangup(pvt->owner);
+	}
+
+
 	close(pvt->rfcomm_socket);
 	close(pvt->sco_socket);
 	pvt->sco_socket = -1;
 
 	pvt->connected = 0;
 
+	pvt->adapter->inuse = 0;
+	ast_mutex_unlock(&pvt->lock);
+
 	manager_event(EVENT_FLAG_SYSTEM, "MobileStatus", "Status: Disconnect\r\nDevice: %s\r\n", pvt->id);
 	ast_verb(3, "Bluetooth Device %s has disconnected\n", pvt->id);
-
-	pvt->adapter->inuse = 0;
 
 	return NULL;
 




More information about the asterisk-addons-commits mailing list