[asterisk-commits] pcadach: branch pcadach/chan_h323-live r41809 - /team/pcadach/chan_h323-live/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Sep 2 11:28:36 MST 2006


Author: pcadach
Date: Sat Sep  2 13:28:36 2006
New Revision: 41809

URL: http://svn.digium.com/view/asterisk?rev=41809&view=rev
Log:
Be sure OpenH323 interface is shutted down when unloading module (including stopping of Asterisk)

Modified:
    team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp

Modified: team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp?rev=41809&r1=41808&r2=41809&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp (original)
+++ team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp Sat Sep  2 13:28:36 2006
@@ -1411,6 +1411,13 @@
 	return FALSE;
 }
 
+/* Special class designed to call cleanup code on module destruction */
+class MyH323_Shutdown {
+	public:
+	MyH323_Shutdown() { };
+	~MyH323_Shutdown() { h323_end_process(); };
+};
+
 /** IMPLEMENTATION OF C FUNCTIONS */
 
 /**
@@ -1427,9 +1434,12 @@
 	}
 	return 1;
 }
-    
+
 void h323_end_point_create(void)
 {
+	/* Call shutdown when module being unload */
+	static MyH323_Shutdown x;
+
 	channelsOpen = 0;
 	logstream = new PAsteriskLog();
 	localProcess = new MyProcess();	
@@ -1808,9 +1818,9 @@
 		close(_timerChangePipe[0]);
 		close(_timerChangePipe[1]);
 	}
-	PTrace::SetLevel(0);
-	PTrace::SetStream(&cout);
 	if (logstream) {
+		PTrace::SetLevel(0);
+		PTrace::SetStream(&cout);
 		delete logstream;
 		logstream = NULL;
 	}



More information about the asterisk-commits mailing list