aboutsummaryrefslogtreecommitdiff
path: root/plugins/ice
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/ice')
-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);