-
-
Notifications
You must be signed in to change notification settings - Fork 420
Description
The WebRTC specification says that the RTCDtlsTransportState
enum should be set to Closed
upon receipt of a close_notify
alert. Currently, webrtc-rs processes the close_notify
but does not update the state of the transport object, leaving it Open.
Here's the section of the WebRTC spec:
https://www.w3.org/TR/webrtc/#rtcdtlstransportstate-enum
See Closed:
closed | The transport has been closed intentionally as the result of receipt of a close_notify alert, or calling close().
The relevant code is in DTLSConn::new()
. Currently it swallows errors and close notifications, but it should bubble those up to be handled by the transport layer, instead, which should then set the state to Closed
, or Failed
as appropriate.
loop {
tokio::select! {
_ = reader_close_rx.recv() => {
trace!(
"{}: read_and_buffer exit",
srv_cli_str(ctx.is_client),
);
break;
}
result = DTLSConn::read_and_buffer(
&mut ctx,
&next_conn_rx,
&mut handle_queue_rx,
&mut buf,
&local_epoch,
&handshake_completed_successfully2,
) => {
if let Err(err) = result {
trace!(
"{}: read_and_buffer return err: {}",
srv_cli_str(is_client),
err
);
if Error::ErrAlertFatalOrClose == err {
trace!(
"{}: read_and_buffer exit with {}",
srv_cli_str(ctx.is_client),
err
);
break;
}
}
}
}
}
The connection properly breaks on Fatal Alerts and Close Alerts, but does not signal the caller to be handled.