Revision 78955474 plugins/janus_audiobridge.c

View differences:

plugins/janus_audiobridge.c
500 500
	gpointer participant;
501 501
	gboolean started;
502 502
	gboolean stopping;
503
	guint64 destroyed;	/* Time at which this session was marked as destroyed */
503
	gboolean hangingup;
504
	gint64 destroyed;	/* Time at which this session was marked as destroyed */
504 505
} janus_audiobridge_session;
505 506
static GHashTable *sessions;
506 507
static GList *old_sessions;
......
876 877
	JANUS_LOG(LOG_VERB, "Removing AudioBridge session...\n");
877 878
	janus_mutex_lock(&sessions_mutex);
878 879
	if(!session->destroyed) {
879
		session->destroyed = janus_get_monotonic_time();
880 880
		g_hash_table_remove(sessions, handle);
881 881
		janus_audiobridge_hangup_media(handle);
882
		session->destroyed = janus_get_monotonic_time();
882 883
		/* Cleaning up and removing the session is done in a lazy way */
883 884
		old_sessions = g_list_append(old_sessions, session);
884 885
	}
......
1532 1533
		JANUS_LOG(LOG_ERR, "No session associated with this handle...\n");
1533 1534
		return;
1534 1535
	}
1535
	if(session->destroyed || !session->participant)
1536
	session->started = FALSE;
1537
	if(session->destroyed || !session->participant || session->hangingup)
1536 1538
		return;
1539
	session->hangingup = TRUE;
1537 1540
	/* Get rid of participant */
1538 1541
	janus_audiobridge_participant *participant = (janus_audiobridge_participant *)session->participant;
1539 1542
	janus_audiobridge_room *audiobridge = participant->room;
......
1562 1565
	}
1563 1566
	/* Free the participant resources */
1564 1567
	janus_mutex_lock(&participant->qmutex);
1565
	session->started = FALSE;
1566 1568
	participant->active = FALSE;
1567 1569
	participant->muted = TRUE;
1568 1570
	if(participant->display)
......
1593 1595
	if(audiobridge != NULL) {
1594 1596
		janus_mutex_unlock(&audiobridge->mutex);
1595 1597
	}
1598
	/* Done */
1599
	session->hangingup = FALSE;
1596 1600
}
1597 1601

  
1598 1602
/* Thread to handle incoming messages */

Also available in: Unified diff