Revision
16516
Author
andrew
Date
2010-01-26 09:44:46 -0600 (Tue, 26 Jan 2010)

Log Message

Don't exit the entire listener for a single session failure (reported by Timur Irmatov)

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c (16515 => 16516)


--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	2010-01-25 22:23:30 UTC (rev 16515)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	2010-01-26 15:44:46 UTC (rev 16516)
@@ -532,14 +532,20 @@
 	while(sp) {
 		removed = NULL;
 		if (switch_test_flag(sp, LFLAG_WAITING_FOR_PID)) {
-			break;
+			sp = sp->next;
+			continue;
 		}
 
 		if (!switch_test_flag(sp, LFLAG_OUTBOUND_INIT)) {
 			status = notify_new_session(listener, sp);
 			if (status != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_UUID_LOG(sp->uuid_str), SWITCH_LOG_DEBUG, "Notifying new session failed\n");
-				break;
+				removed = sp;
+				sp = removed->next;
+
+				remove_session_elem_from_listener(listener, removed);
+				destroy_session_elem(removed);
+				continue;
 			}
 			switch_set_flag(sp, LFLAG_OUTBOUND_INIT);
 		}
@@ -610,7 +616,11 @@
 		sp = sp->next;
 	}
 	switch_mutex_unlock(listener->session_mutex);
-	return status;
+	if (prefs.done) {
+		return SWITCH_STATUS_FALSE; /* we're shutting down */
+	} else {
+		return SWITCH_STATUS_SUCCESS;
+	}
 }
 
 static void check_log_queue(listener_t *listener)