[asterisk-addons-commits] trunk - r189
/trunk/asterisk-ooh323c/src/chan_h323.c
asterisk-addons-commits at lists.digium.com
asterisk-addons-commits at lists.digium.com
Thu Jan 19 13:55:48 MST 2006
Author: objsys
Date: Thu Jan 19 14:55:47 2006
New Revision: 189
URL: http://svn.digium.com/view/asterisk-addons?rev=189&view=rev
Log:
Fix for asterisk crash on reloading channel driver, Bug#5379
Modified:
trunk/asterisk-ooh323c/src/chan_h323.c
Modified: trunk/asterisk-ooh323c/src/chan_h323.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/asterisk-ooh323c/src/chan_h323.c?rev=189&r1=188&r2=189&view=diff
==============================================================================
--- trunk/asterisk-ooh323c/src/chan_h323.c (original)
+++ trunk/asterisk-ooh323c/src/chan_h323.c Thu Jan 19 14:55:47 2006
@@ -1694,16 +1694,17 @@
static int ooh323_do_reload(void)
{
-
- if(gH323Debug)
+ if(gH323Debug) {
ast_verbose("--- ooh323_do_reload\n");
+ }
delete_users();
delete_peers();
reload_config();
- if(gH323Debug)
+ if(gH323Debug) {
ast_verbose("+++ ooh323_do_reload\n");
+ }
return 0;
}
@@ -2079,9 +2080,10 @@
while(user)
{
ast_mutex_lock(&user->lock);
- if(!strcmp(user->name, argv[3]))
+ if(!strcmp(user->name, argv[3])) {
break;
- else{
+ }
+ else {
prev = user;
user = user->next;
ast_mutex_unlock(&prev->lock);
@@ -2623,14 +2625,17 @@
{
prev = cur;
cur = cur->next;
+
ast_mutex_destroy(&prev->lock);
if(prev->h323id) free(prev->h323id);
if(prev->email) free(prev->email);
if(prev->url) free(prev->url);
if(prev->e164) free(prev->e164);
-
free(prev);
- }
+
+ if(cur == peerl.peers) { break; }
+ }
+ peerl.peers = NULL;
ast_mutex_unlock(&peerl.lock);
return 0;
}
@@ -2646,7 +2651,9 @@
cur = cur->next;
ast_mutex_destroy(&prev->lock);
free(prev);
- }
+ if(cur == userl.users) { break; }
+ }
+ userl.users = NULL;
ast_mutex_unlock(&userl.lock);
return 0;
}
@@ -2656,8 +2663,9 @@
struct ooh323_pvt *p, *pl;
struct ooAliases *cur=NULL, *prev=NULL;
- if(gH323Debug)
+ if(gH323Debug) {
ast_verbose("--- ooh323 unload_module \n");
+ }
/* First, take us out of the channel loop */
ast_cli_unregister(&cli_show_users);
ast_cli_unregister(&cli_show_user);
@@ -2669,30 +2677,30 @@
ast_rtp_proto_unregister(&ooh323_rtp);
ast_channel_unregister(&ooh323_tech);
- if(gH323Debug)
+ if(gH323Debug) {
ast_verbose(" unload_module - hanging up all interfaces\n");
-
+ }
if (!ast_mutex_lock(&iflock)) {
-
/* Hangup all interfaces if they have an owner */
p = iflist;
while(p) {
- if (p->owner)
+ if (p->owner) {
ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
+ }
p = p->next;
}
iflist = NULL;
ast_mutex_unlock(&iflock);
-
- } else {
+ }
+ else {
ast_log(LOG_WARNING, "Unable to lock the interface list\n");
return -1;
}
- if(gH323Debug)
+
+ if(gH323Debug) {
ast_verbose(" unload_module - stopping monitor thread\n");
-
-
+ }
if (monitor_thread != AST_PTHREADT_NULL)
{
if(!ast_mutex_lock(&monlock)) {
@@ -2703,20 +2711,24 @@
}
monitor_thread = AST_PTHREADT_STOP;
ast_mutex_unlock(&monlock);
- } else {
+ }
+ else {
ast_log(LOG_WARNING, "Unable to lock the monitor\n");
return -1;
}
}
- if(gH323Debug)
+
+ if(gH323Debug) {
ast_verbose(" unload_module - stopping stack thread\n");
+ }
ooh323c_stop_stack_thread();
- if(gH323Debug)
+
+
+ if(gH323Debug) {
ast_verbose(" unload_module - freeing up memory used by interfaces\n");
-
+ }
if (!ast_mutex_lock(&iflock)) {
-
/* Destroy all the interfaces and free their memory */
p = iflist;
while(p) {
@@ -2726,26 +2738,29 @@
ooh323_destroy(p);
}
iflist = NULL;
-
ast_mutex_unlock(&iflock);
-
- } else {
+ }
+ else {
ast_log(LOG_WARNING, "Unable to lock the interface list\n");
return -1;
}
- if(gH323Debug)
- ast_verbose(" unload_module - deleting users\n");
-
+
+ if(gH323Debug) {
+ ast_verbose(" unload_module - deleting users\n");
+ }
delete_users();
- if(gH323Debug)
+
+ if(gH323Debug) {
ast_verbose(" unload_module - deleting peers\n");
+ }
delete_peers();
- if(gH323Debug)
+
+ if(gH323Debug) {
ast_verbose(" unload_module - Freeing up alias list\n");
-
+ }
cur = gAliasList;
while(cur)
{
@@ -2754,14 +2769,17 @@
free(prev->value);
free(prev);
}
-
- if(gH323Debug)
+ gAliasList = NULL;
+
+
+ if(gH323Debug) {
ast_verbose(" unload_module- destroying OOH323 endpoint \n");
-
+ }
ooH323EpDestroy();
- if(gH323Debug)
+ if(gH323Debug) {
ast_verbose("+++ ooh323 unload_module \n");
+ }
return 0;
}
More information about the asterisk-addons-commits
mailing list