diff options
author | fiaxh <git@lightrise.org> | 2021-04-09 19:04:24 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2021-04-09 22:23:56 +0200 |
commit | 5e11986838057a5cdbdf9d271316513da1bd4764 (patch) | |
tree | cca129e6de5250f9f9bca15c0cc0ea01ac467cb0 /plugins/ice | |
parent | 09dc38f169745cb7697fdb969b9d4eb5e021e07a (diff) | |
download | dino-5e11986838057a5cdbdf9d271316513da1bd4764.tar.gz dino-5e11986838057a5cdbdf9d271316513da1bd4764.zip |
Fix dtls pull_timeout_function, fix cyclic references
Diffstat (limited to 'plugins/ice')
-rw-r--r-- | plugins/ice/src/dtls_srtp.vala | 10 | ||||
-rw-r--r-- | plugins/ice/src/transport_parameters.vala | 8 |
2 files changed, 12 insertions, 6 deletions
diff --git a/plugins/ice/src/dtls_srtp.vala b/plugins/ice/src/dtls_srtp.vala index 8a9b5dfa..e8fc01c7 100644 --- a/plugins/ice/src/dtls_srtp.vala +++ b/plugins/ice/src/dtls_srtp.vala @@ -216,9 +216,7 @@ public class Handler { private static int pull_timeout_function(void* transport_ptr, uint ms) { Handler self = transport_ptr as Handler; - DateTime current_time = new DateTime.now_utc(); - current_time.add_seconds(ms/1000); - int64 end_time = current_time.to_unix(); + int64 end_time = get_monotonic_time() + ms * 1000; self.buffer_mutex.lock(); while (self.buffer_queue.size == 0) { @@ -228,9 +226,9 @@ public class Handler { return -1; } - DateTime new_current_time = new DateTime.now_utc(); - if (new_current_time.compare(current_time) > 0) { - break; + if (get_monotonic_time() > end_time) { + self.buffer_mutex.unlock(); + return 0; } } self.buffer_mutex.unlock(); diff --git a/plugins/ice/src/transport_parameters.vala b/plugins/ice/src/transport_parameters.vala index e4862edc..f854a367 100644 --- a/plugins/ice/src/transport_parameters.vala +++ b/plugins/ice/src/transport_parameters.vala @@ -40,6 +40,7 @@ public class Dino.Plugins.Ice.TransportParameters : JingleIceUdp.IceUdpTransport yield base.terminate(we_terminated, reason_string, reason_text); this.disconnect(datagram_received_id); agent = null; + dtls_srtp_handler = null; } public override void send_datagram(Bytes datagram) { @@ -324,4 +325,11 @@ public class Dino.Plugins.Ice.TransportParameters : JingleIceUdp.IceUdpTransport return candidate; } + + public override void dispose() { + base.dispose(); + agent = null; + dtls_srtp_handler = null; + connections.clear(); + } } |