diff options
author | Marvin W <git@larma.de> | 2021-12-18 21:39:19 +0100 |
---|---|---|
committer | Marvin W <git@larma.de> | 2021-12-18 21:39:19 +0100 |
commit | 09cd060889c27f51d43e1e2dc127c2a13595234d (patch) | |
tree | 0925ad51d3c73803f5e5de3677ca8a32e402a067 /plugins/ice | |
parent | 52698a23d321089810a0e2a10d59c461a00c83e0 (diff) | |
download | dino-09cd060889c27f51d43e1e2dc127c2a13595234d.tar.gz dino-09cd060889c27f51d43e1e2dc127c2a13595234d.zip |
ICE: Use non-blocking send
Diffstat (limited to 'plugins/ice')
-rw-r--r-- | plugins/ice/src/transport_parameters.vala | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/plugins/ice/src/transport_parameters.vala b/plugins/ice/src/transport_parameters.vala index f42fad64..9aa3dda1 100644 --- a/plugins/ice/src/transport_parameters.vala +++ b/plugins/ice/src/transport_parameters.vala @@ -39,17 +39,23 @@ public class Dino.Plugins.Ice.TransportParameters : JingleIceUdp.IceUdpTransport public override void send_datagram(Bytes datagram) { if (this.agent != null && is_component_ready(agent, stream_id, component_id)) { - uint8[] encrypted_data = null; - if (dtls_srtp_handler != null) { - try { - encrypted_data = dtls_srtp_handler.process_outgoing_data(component_id, datagram.get_data()); + try { + if (dtls_srtp_handler != null) { + uint8[] encrypted_data = dtls_srtp_handler.process_outgoing_data(component_id, datagram.get_data()); if (encrypted_data == null) return; - } catch (Crypto.Error e) { - warning("%s while send_datagram stream %u component %u", e.message, stream_id, component_id); + // TODO: Nonblocking might require certain libnice versions? + GLib.OutputVector[] vectors = {{ encrypted_data, encrypted_data.length }}; + Nice.OutputMessage[] messages = {{ vectors }}; + agent.send_messages_nonblocking(stream_id, component_id, messages); + } else { + GLib.OutputVector[] vectors = {{ datagram.get_data(), datagram.get_size() }}; + Nice.OutputMessage[] messages = {{ vectors }}; + agent.send_messages_nonblocking(stream_id, component_id, messages); } + bytes_sent += datagram.length; + } catch (GLib.Error e) { + warning("%s while send_datagram stream %u component %u", e.message, stream_id, component_id); } - agent.send(stream_id, component_id, encrypted_data ?? datagram.get_data()); - bytes_sent += datagram.length; } } } |