in chime/chime-call-transport.c [616:669]
void chime_call_transport_disconnect(ChimeCallAudio *audio, gboolean hangup)
{
if (audio->send_rt_source) {
g_source_remove(audio->send_rt_source);
audio->send_rt_source = 0;
}
g_hash_table_remove_all(audio->profiles);
chime_call_audio_cleanup_datamsgs(audio);
if (hangup && audio->state >= CHIME_AUDIO_STATE_AUDIOLESS)
audio_send_hangup_packet(audio);
g_mutex_lock(&audio->transport_lock);
if (audio->cancel) {
g_cancellable_cancel(audio->cancel);
g_object_unref(audio->cancel);
audio->cancel = NULL;
}
if (audio->ws) {
g_signal_handlers_disconnect_matched(G_OBJECT(audio->ws), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, audio);
g_signal_connect(G_OBJECT(audio->ws), "closed", G_CALLBACK(on_final_audiows_close), NULL);
soup_websocket_connection_close(audio->ws, 0, NULL);
audio->ws = NULL;
} else if (audio->dtls_sess) {
gnutls_deinit(audio->dtls_sess);
audio->dtls_sess = NULL;
if (audio->dtls_source) {
g_source_destroy(audio->dtls_source);
audio->dtls_source = NULL;
}
g_clear_object(&audio->dtls_sock);
}
if (audio->dtls_hostname) {
g_free(audio->dtls_hostname);
audio->dtls_hostname = NULL;
}
if (audio->timeout_source) {
g_source_remove(audio->timeout_source);
audio->timeout_source = 0;
}
if (hangup && audio->dtls_cred) {
gnutls_certificate_free_credentials(audio->dtls_cred);
audio->dtls_cred = NULL;
}
g_mutex_unlock(&audio->transport_lock);
}