Revision 3a3cc054 plugins/janus_sip.c

View differences:

plugins/janus_sip.c
633 633
	session->media.video_ssrc = 0;
634 634
	session->media.video_ssrc_peer = 0;
635 635
	session->destroyed = 0;
636
	g_atomic_int_set(&session->hangingup, 1);
636 637
	su_home_init(session->stack->s_home);
637 638
	janus_mutex_init(&session->mutex);
638 639
	handle->plugin_handle = session;
......
720 721
	}
721 722
	if(session->destroyed)
722 723
		return;
724
	g_atomic_int_set(&session->hangingup, 0);
723 725
	/* TODO Only relay RTP/RTCP when we get this event */
724 726
}
725 727

  
......
798 800
		JANUS_LOG(LOG_ERR, "No session associated with this handle...\n");
799 801
		return;
800 802
	}
801
	if(session->destroyed || g_atomic_int_get(&session->hangingup))
803
	if(session->destroyed)
804
		return;
805
	if(g_atomic_int_add(&session->hangingup, 1))
802 806
		return;
803
	g_atomic_int_set(&session->hangingup, 1);
804 807
	if(!(session->status == janus_sip_call_status_inviting ||
805 808
		 session->status == janus_sip_call_status_invited ||
806 809
		 session->status == janus_sip_call_status_incall))
......
813 816
	msg->sdp_type = NULL;
814 817
	msg->sdp = NULL;
815 818
	g_async_queue_push(messages, msg);
816
	/* Done */
817
	g_atomic_int_set(&session->hangingup, 0);
818 819
}
819 820

  
820 821
/* Thread to handle incoming messages */

Also available in: Unified diff