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

FreeSWITCH SVN andrew at freeswitch.org
Fri Jan 23 18:08:06 PST 2009


Author: andrew
Date: Fri Jan 23 20:08:06 2009
New Revision: 11479

Log:
Fix some issues with standing up a new outbound listener and cleaning up after a failed session (more issues remain)


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	Fri Jan 23 20:08:06 2009
@@ -864,10 +864,11 @@
 	switch_queue_create(&listener->event_queue, SWITCH_CORE_QUEUE_LEN, listener_pool);
 	switch_queue_create(&listener->log_queue, SWITCH_CORE_QUEUE_LEN, listener_pool);
 		
-	listener->ec = ec;
 	listener->sockfd = clientfd;
 	listener->pool = listener_pool;
 	listener_pool = NULL;
+	listener->ec = switch_core_alloc(listener->pool, sizeof(ei_cnode));
+	memcpy(listener->ec, ec, sizeof(ei_cnode));
 	listener->level = SWITCH_LOG_DEBUG;
 	switch_mutex_init(&listener->flag_mutex, SWITCH_MUTEX_NESTED, listener->pool);
 	switch_mutex_init(&listener->sock_mutex, SWITCH_MUTEX_NESTED, listener->pool);
@@ -945,6 +946,7 @@
 			while (!(pid = (erlang_pid *) switch_core_hash_find(listener->spawn_pid_hash, hash))) {
 				if (i > 50) { /* half a second timeout */
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "timed out!\n");
+					switch_core_session_rwunlock(session);
 					return NULL;
 				}
 				i++;
@@ -1013,7 +1015,7 @@
 		return;
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "enter erlang_outbound_function %s %s\n",reg_name, node);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "enter erlang_outbound_function %s %s\n",argv[0], node);
 
 	/* first work out if there is a listener already talking to the node we want to talk to */
 	listener = find_listener(node);
@@ -1022,6 +1024,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating new listener for session\n");
 		new_session = SWITCH_TRUE;
 		listener = new_outbound_listener(node);
+		add_listener(listener);
 	}
 	else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Using existing listener for session\n");



More information about the Freeswitch-svn mailing list