]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3488 --resolve
authorAndrew Thompson <andrew@hijacked.us>
Sat, 20 Aug 2011 23:45:36 +0000 (19:45 -0400)
committerAndrew Thompson <andrew@hijacked.us>
Sat, 20 Aug 2011 23:45:36 +0000 (19:45 -0400)
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c

index 9a09e802c30c17e2272608e72a77a4889da95bf2..92e30ecfb6ad3b3178e1dcb071655747141a855a 100644 (file)
@@ -549,6 +549,7 @@ static switch_status_t check_attached_sessions(listener_t *listener)
        const void *key;
        void * value;
        switch_hash_index_t *iter;
+       /* event used to track sessions to remove */
        switch_event_t *event = NULL;
        switch_event_header_t *header = NULL;
        switch_event_create_subclass(&event, SWITCH_EVENT_CLONE, NULL);
@@ -570,6 +571,7 @@ static switch_status_t check_attached_sessions(listener_t *listener)
                        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");
+                               /* mark this session for removal */
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delete", (const char *) key);
                                continue;
                        }
@@ -650,6 +652,10 @@ static switch_status_t check_attached_sessions(listener_t *listener)
        }
 
        switch_thread_rwlock_unlock(listener->session_rwlock);
+
+       /* remove the temporary event */
+       switch_event_destroy(&event);
+
        if (prefs.done) {
                return SWITCH_STATUS_FALSE;     /* we're shutting down */
        } else {