[asterisk-commits] nadi: branch crichter/0.4.0 r40177 - /team/crichter/0.4.0/channels/chan_misdn.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Aug 17 02:03:05 MST 2006


Author: nadi
Date: Thu Aug 17 04:03:05 2006
New Revision: 40177

URL: http://svn.digium.com/view/asterisk?rev=40177&view=rev
Log:
fixing the 64 bit issue with misdn_l1_task.

Modified:
    team/crichter/0.4.0/channels/chan_misdn.c

Modified: team/crichter/0.4.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/chan_misdn.c?rev=40177&r1=40176&r2=40177&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/chan_misdn.c (original)
+++ team/crichter/0.4.0/channels/chan_misdn.c Thu Aug 17 04:03:05 2006
@@ -254,6 +254,8 @@
 /* the main schedule context for stuff like l1 watcher, overlap dial, ... */
 static struct sched_context *misdn_tasks = NULL;
 static pthread_t misdn_tasks_thread;
+
+static int *misdn_ports;
 
 static void chan_misdn_log(int level, int port, char *tmpl, ...);
 
@@ -552,8 +554,8 @@
 
 static int misdn_l1_task (void *data)
 {
-	misdn_lib_isdn_l1watcher((int)data);
-	chan_misdn_log(5, (int)data, "L1watcher timeout\n");
+	misdn_lib_isdn_l1watcher(*(int *)data);
+	chan_misdn_log(5, *(int *)data, "L1watcher timeout\n");
 	return 1;
 }
 
@@ -4472,11 +4474,16 @@
 	g_config_initialized=1;
 	
 	misdn_debug = (int *)malloc(sizeof(int) * (max_ports+1));
+	misdn_ports = (int *)malloc(sizeof(int) * (max_ports+1));
 	misdn_cfg_get( 0, MISDN_GEN_DEBUG, &misdn_debug[0], sizeof(int));
-	for (i = 1; i <= max_ports; i++)
+	for (i = 1; i <= max_ports; i++) {
 		misdn_debug[i] = misdn_debug[0];
+		misdn_ports[i] = i;
+	}
+	*misdn_ports = 0;
 	misdn_debug_only = (int *)calloc(max_ports + 1, sizeof(int));
 
+	ast_mutex_init(&usecnt_lock);
 	
 	{
 		char tempbuf[BUFFERSIZE+1];
@@ -4576,7 +4583,7 @@
 		misdn_cfg_get(port, MISDN_CFG_L1_TIMEOUT, &l1timeout, sizeof(l1timeout));
 		if (l1timeout) {
 			chan_misdn_log(4, 0, "Adding L1watcher task: port:%d timeout:%ds\n", port, l1timeout);
-			misdn_tasks_add(l1timeout * 1000, misdn_l1_task, (void*)port);  
+			misdn_tasks_add(l1timeout * 1000, misdn_l1_task, &misdn_ports[port]);  
 		}
 	}
 	
@@ -4618,7 +4625,10 @@
 		free(misdn_debug);
 	if (misdn_debug_only)
 		free(misdn_debug_only);
-	
+	free(misdn_ports);
+	
+	ast_mutex_destroy(&usecnt_lock);
+
 	return 0;
 }
 



More information about the asterisk-commits mailing list