aboutsummaryrefslogtreecommitdiff
path: root/plugins/ice
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/ice')
-rw-r--r--plugins/ice/src/dtls_srtp.vala20
-rw-r--r--plugins/ice/src/transport_parameters.vala3
2 files changed, 20 insertions, 3 deletions
diff --git a/plugins/ice/src/dtls_srtp.vala b/plugins/ice/src/dtls_srtp.vala
index 6701fe89..f5ef830a 100644
--- a/plugins/ice/src/dtls_srtp.vala
+++ b/plugins/ice/src/dtls_srtp.vala
@@ -153,7 +153,13 @@ public class Handler {
DateTime current_time = new DateTime.now_utc();
if (maximum_time.compare(current_time) < 0) {
warning("DTLS handshake timeouted");
- return ErrorCode.APPLICATION_ERROR_MIN + 1;
+ err = ErrorCode.APPLICATION_ERROR_MIN + 1;
+ break;
+ }
+ if (stop) {
+ debug("DTLS handshake stopped");
+ err = ErrorCode.APPLICATION_ERROR_MIN + 2;
+ break;
}
} while (err < 0 && !((ErrorCode)err).is_fatal());
Idle.add(setup_dtls_connection.callback);
@@ -167,11 +173,17 @@ public class Handler {
running = false;
bool restart = restart;
buffer_mutex.unlock();
- if (restart) return yield setup_dtls_connection();
+ if (restart) {
+ debug("Restarting DTLS handshake");
+ return yield setup_dtls_connection();
+ }
return null;
}
buffer_mutex.unlock();
- throw_if_error(err);
+ if (err != ErrorCode.SUCCESS) {
+ warning("DTLS handshake failed: %s", ((ErrorCode)err).to_string());
+ return null;
+ }
uint8[] km = new uint8[150];
Datum? client_key, client_salt, server_key, server_salt;
@@ -199,6 +211,7 @@ public class Handler {
self.buffer_cond.wait(self.buffer_mutex);
if (self.stop) {
self.buffer_mutex.unlock();
+ debug("DTLS handshake pull_function stopped");
return -1;
}
}
@@ -222,6 +235,7 @@ public class Handler {
self.buffer_cond.wait_until(self.buffer_mutex, end_time);
if (self.stop) {
self.buffer_mutex.unlock();
+ debug("DTLS handshake pull_timeout_function stopped");
return -1;
}
diff --git a/plugins/ice/src/transport_parameters.vala b/plugins/ice/src/transport_parameters.vala
index 8766e744..52451fcf 100644
--- a/plugins/ice/src/transport_parameters.vala
+++ b/plugins/ice/src/transport_parameters.vala
@@ -156,6 +156,9 @@ public class Dino.Plugins.Ice.TransportParameters : JingleIceUdp.IceUdpTransport
if (peer_setup == "passive") {
dtls_srtp_handler.mode = DtlsSrtp.Mode.CLIENT;
dtls_srtp_handler.stop_dtls_connection();
+ dtls_srtp_handler.setup_dtls_connection.begin((_, res) => {
+ this.content.encryption = dtls_srtp_handler.setup_dtls_connection.end(res) ?? this.content.encryption;
+ });
}
} else {
dtls_srtp_handler = null;