[asterisk-commits] jpeeler: branch jpeeler/dahdi-restart r136852 - /team/jpeeler/dahdi-restart/c...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 8 15:39:48 CDT 2008


Author: jpeeler
Date: Fri Aug  8 15:39:47 2008
New Revision: 136852

URL: http://svn.digium.com/view/asterisk?view=rev&rev=136852
Log:
remove / change debugging code to ast_debug with proper priorities

Modified:
    team/jpeeler/dahdi-restart/channels/chan_dahdi.c

Modified: team/jpeeler/dahdi-restart/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/dahdi-restart/channels/chan_dahdi.c?view=diff&rev=136852&r1=136851&r2=136852
==============================================================================
--- team/jpeeler/dahdi-restart/channels/chan_dahdi.c (original)
+++ team/jpeeler/dahdi-restart/channels/chan_dahdi.c Fri Aug  8 15:39:47 2008
@@ -3394,10 +3394,7 @@
 				tmp = tmp->next;
 			}
 		}
-	} else {
-		//ast_log(LOG_WARNING, "******************* Important, not destroyed here\n");
-	}
-
+	}
 	ast_mutex_unlock(&iflock);
 
 	return 0;
@@ -12031,16 +12028,16 @@
 
 	ast_verb(1, "Destroying channels and reloading DAHDI configuration.\n");
 	dahdi_softhangup_all();
-	ast_verb(2, "Initial softhangup of all DAHDI channels complete.\n");
+	ast_verb(4, "Initial softhangup of all DAHDI channels complete.\n");
 
 	#if defined(HAVE_PRI)
     for (i = 0; i < NUM_SPANS; i++) {
 		if (pris[i].master && (pris[i].master != AST_PTHREADT_NULL)) {
 			cancel_code = pthread_cancel(pris[i].master);
 			pthread_kill(pris[i].master, SIGURG);
-			ast_log(LOG_WARNING, "Waiting to join thread of span %d with pid=%p cancel_code=%d\n", i, (void *) pris[i].master, cancel_code);
+			ast_debug(4, "Waiting to join thread of span %d with pid=%p, cancel_code=%d\n", i, (void *) pris[i].master, cancel_code);
             pthread_join(pris[i].master, NULL);
-			ast_log(LOG_WARNING, "Joined thread of span %d\n", i);
+			ast_debug(4, "Joined thread of span %d\n", i);
 		}
 		for (j = 0; j < pris[i].numchans - 1; j++) {
 			struct dahdi_pvt *p = pris[i].pvts[j];
@@ -12053,16 +12050,10 @@
 					}
 					if (p->realcall) {
 						pri_hangup_all(p->realcall, &pris[i]);
-					} else if (p->owner)
-						p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
-				}
-			}
-		}
-/*
-		for (j = 0; j < NUM_DCHANS; j++) {
-        	dahdi_close(pris[i].fds[j]);
-		}
-*/
+					}
+				}
+			}
+		}
     }
 	#endif /* HAVE_PRI */
 
@@ -12071,9 +12062,9 @@
 		if (linksets[i].master && (linksets[i].master != AST_PTHREADT_NULL)) {
 			cancel_code = pthread_cancel(linksets[i].master);
 			pthread_kill(linksets[i].master, SIGURG);
-			ast_log(LOG_WARNING, "Waiting to join thread of span %d with pid=%p cancel_code=%d\n", i, (void *) linksets[i].master, cancel_code);
+			ast_debug(4, "Waiting to join thread of span %d with pid=%p, cancel_code=%d\n", i, (void *) linksets[i].master, cancel_code);
 			pthread_join(linksets[i].master, NULL);
-			ast_log(LOG_WARNING, "Joined thread of span %d\n", i);
+			ast_debug(4, "Joined thread of span %d\n", i);
 		}
 //		for (j = 0; j < linksets[i].numchans - 1; j++) {
 //			struct dahdi_pvt *p = linksets[i].pvts[j];
@@ -12104,16 +12095,17 @@
 
     ast_mutex_lock(&monlock);
     if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP) && (monitor_thread != AST_PTHREADT_NULL)) {
-		int retval;
-        retval = pthread_cancel(monitor_thread);
-        retval = pthread_kill(monitor_thread, SIGURG);
-        retval = pthread_join(monitor_thread, NULL);
+		cancel_code = pthread_cancel(monitor_thread);
+		pthread_kill(monitor_thread, SIGURG);
+		ast_debug(4, "Waiting to join monitor thread with pid=%p, cancel_code=%d\n", (void *) monitor_thread, cancel_code);
+        pthread_join(monitor_thread, NULL);
+		ast_debug(4, "Joined monitor thread\n");
     }
 	monitor_thread = AST_PTHREADT_NULL; /* prepare to restart thread in setup_dahdi once channels are reconfigured */
 
 	ast_mutex_lock(&mwi_thread_lock);
 	while (mwi_thread_count > 0) {
-		ast_log(LOG_WARNING, "Waiting on mwi_send_thread to finish\n");
+		ast_debug(3, "Waiting on %d mwi_send_thread(s) to finish\n", mwi_thread_count);
 		ast_cond_wait(&mwi_thread_complete, &mwi_thread_lock);
 	}
 	ast_mutex_unlock(&mwi_thread_lock);
@@ -12121,7 +12113,7 @@
 	ast_mutex_lock(&ss_thread_lock);
 	while (ss_thread_count > 0) { /* let ss_threads finish and run dahdi_hangup before dahvi_pvts are destroyed */
 		int x = DAHDI_FLASH;
-		ast_debug(3, "Waiting on ss_thread to finish\n");
+		ast_debug(3, "Waiting on %d ss_thread(s) to finish\n", ss_thread_count);
 
 		for (p = iflist; p; p = p->next) {
 			if (p->owner)
@@ -12132,7 +12124,7 @@
 
 	/* ensure any created channels before monitor threads were stopped are hungup */
 	dahdi_softhangup_all();
-	ast_verb(2, "Final softhangup of all DAHDI channels complete.\n");
+	ast_verb(4, "Final softhangup of all DAHDI channels complete.\n");
 	destroy_all_channels();
 	ast_debug(1, "Channels destroyed. Now re-reading config. %d active channels remaining.\n", ast_active_channels());
 
@@ -13589,11 +13581,9 @@
 	ast_channel_unregister(&dahdi_tech);
 	ast_mutex_lock(&iflock);
 	/* Hangup all interfaces if they have an owner */
-	p = iflist;
-	while (p) {
+	for (p = iflist; p; p = p->next) {
 		if (p->owner)
 			ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
-		p = p->next;
 	}
 	ast_mutex_unlock(&iflock);
 	ast_mutex_lock(&monlock);
@@ -13605,7 +13595,6 @@
 	monitor_thread = AST_PTHREADT_STOP;
 	ast_mutex_unlock(&monlock);
 
-	/* jpeeler TODO: remember that num_restart_pending is set in dahdi_softhangup_all */
 	destroy_all_channels();
 #if defined(HAVE_PRI)
 	for (i = 0; i < NUM_SPANS; i++) {




More information about the asterisk-commits mailing list