aboutsummaryrefslogtreecommitdiff
path: root/plugins/ice/src
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2021-03-29 13:14:10 +0200
committerMarvin W <git@larma.de>2021-03-29 13:14:10 +0200
commitfd21eafe26a7b72fd3eee575c42654a5219abee3 (patch)
tree8dc3568e2a194c1358377d6700d08eb2de1821ab /plugins/ice/src
parentfc3263d49e5a5c737742eb7e591498ade830b685 (diff)
downloaddino-fd21eafe26a7b72fd3eee575c42654a5219abee3.tar.gz
dino-fd21eafe26a7b72fd3eee575c42654a5219abee3.zip
Fix cyclic reference in DTLS
Diffstat (limited to 'plugins/ice/src')
-rw-r--r--plugins/ice/src/transport_parameters.vala15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/ice/src/transport_parameters.vala b/plugins/ice/src/transport_parameters.vala
index 5b6431c2..2db1ab1b 100644
--- a/plugins/ice/src/transport_parameters.vala
+++ b/plugins/ice/src/transport_parameters.vala
@@ -65,10 +65,7 @@ public class Dino.Plugins.Ice.TransportParameters : JingleIceUdp.IceUdpTransport
this.agent = agent;
if (this.peer_fingerprint != null || !incoming) {
- dtls_srtp = DtlsSrtp.setup();
- dtls_srtp.send_data.connect((data) => {
- agent.send(stream_id, 1, data);
- });
+ dtls_srtp = setup_dtls(this);
this.own_fingerprint = dtls_srtp.get_own_fingerprint(GnuTLS.DigestAlgorithm.SHA256);
if (incoming) {
dtls_srtp.set_peer_fingerprint(this.peer_fingerprint);
@@ -105,6 +102,16 @@ public class Dino.Plugins.Ice.TransportParameters : JingleIceUdp.IceUdpTransport
agent.gather_candidates(stream_id);
}
+ private static DtlsSrtp setup_dtls(TransportParameters tp) {
+ var weak_self = new WeakRef(tp);
+ DtlsSrtp dtls_srtp = DtlsSrtp.setup();
+ dtls_srtp.send_data.connect((data) => {
+ TransportParameters self = (TransportParameters) weak_self.get();
+ if (self != null) self.agent.send(self.stream_id, 1, data);
+ });
+ return dtls_srtp;
+ }
+
private void on_candidate_gathering_done(uint stream_id) {
if (stream_id != this.stream_id) return;
debug("on_candidate_gathering_done in %u", stream_id);