[Freeswitch-svn] [commit] r10317 - freeswitch/trunk/src/mod/event_handlers/mod_erlang_event

FreeSWITCH SVN andrew at freeswitch.org
Mon Nov 10 11:42:38 PST 2008


Author: andrew
Date: Mon Nov 10 14:42:38 2008
New Revision: 10317

Log:
Add a 1.5 second sleep on module shutdown to prevent segfaults, fix a compiler warning


Modified:
   freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c

Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	Mon Nov 10 14:42:38 2008
@@ -302,17 +302,23 @@
 
 	prefs.done = 1;
 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "prefs.done: %d\n", prefs.done);
+
 	switch_log_unbind_logger(socket_logger);
 
 	/*close_socket(&listen_list.sockfd);*/
 	
 	while (prefs.threads || prefs.done == 1) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "prefs.done: %d\n", prefs.done);
 		switch_yield(10000);
 		if (++sanity == 1000) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Hung Thread!\n");
 			break;
 		}
 	}
 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "prefs.done: %d\n", prefs.done);
+
 	switch_event_unbind(&globals.node);
 
 	switch_mutex_lock(globals.listener_mutex);
@@ -323,6 +329,8 @@
 
 	switch_mutex_unlock(globals.listener_mutex);
 
+	switch_sleep(1500000); /* sleep for 1.5 seconds */
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -774,7 +782,7 @@
 			}
 
 			switch_core_session_t *session;
-			if (uuid && (session = switch_core_session_locate(uuid))) {
+			if ((session = switch_core_session_locate(uuid))) {
 			} else {
 				ei_x_encode_tuple_header(rbuf, 2);
 				ei_x_encode_atom(rbuf, "error");
@@ -1346,8 +1354,8 @@
 		switch_safe_free(prefs.acl[x]);
 	}
 
-	prefs.done = 2;
   fail:
+	prefs.done = 2;
 	return SWITCH_STATUS_TERM;
 }
 



More information about the Freeswitch-svn mailing list