Revision 3a3cc054 plugins/janus_voicemail.c

View differences:

plugins/janus_voicemail.c
457 457
	session->started = FALSE;
458 458
	session->stopping = FALSE;
459 459
	session->destroyed = 0;
460
	g_atomic_int_set(&session->hangingup, 1);
460 461
	handle->plugin_handle = session;
461 462
	janus_mutex_lock(&sessions_mutex);
462 463
	g_hash_table_insert(sessions, handle, session);
......
543 544
	}
544 545
	if(session->destroyed)
545 546
		return;
547
	g_atomic_int_set(&session->hangingup, 0);
546 548
	/* Only start recording this peer when we get this event */
547 549
	session->start_time = janus_get_monotonic_time();
548 550
	session->started = TRUE;
......
611 613
		return;
612 614
	}
613 615
	session->started = FALSE;
614
	if(session->destroyed || g_atomic_int_get(&session->hangingup))
616
	if(session->destroyed)
617
		return;
618
	if(g_atomic_int_add(&session->hangingup, 1))
615 619
		return;
616
	g_atomic_int_set(&session->hangingup, 1);
617 620
	/* Close and reset stuff */
618 621
	if(session->file)
619 622
		fclose(session->file);
......
621 624
	if(session->stream)
622 625
		ogg_stream_destroy(session->stream);
623 626
	session->stream = NULL;
624
	/* Done */
625
	g_atomic_int_set(&session->hangingup, 0);
626 627
}
627 628

  
628 629
/* Thread to handle incoming messages */

Also available in: Unified diff