Skip to content

Add close/1. Handle DTLS close_notify alert #218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 16, 2025
Merged

Add close/1. Handle DTLS close_notify alert #218

merged 4 commits into from
Jun 16, 2025

Conversation

mickel8
Copy link
Member

@mickel8 mickel8 commented Jun 2, 2025

This PR:

  • adds close/1 that irreversibly closes peer connection. Most of the functions (except getters) will return {:error, :invalid_state} when called after closing peer connection. Calling close/1 will also send close_notify DTLS alert to the other side
  • handles incoming close_notify DTLS alert. This alert moves DTLS transport to the closed state but does not move peer connection, signaling or ice transport to the closed state. Peer connection that received close_notify DTLS alert can still do ice restart with a different peer. See: RTCPeerConnection does not move to the closed state when RTCDTLSTransport receives close_notify DTLS alert w3c/webrtc-pc#3053

Resources:

  • W3C WebRTC sec 5.5.1

closes elixir-webrtc/ex_ice#78

Copy link

codecov bot commented Jun 2, 2025

Codecov Report

Attention: Patch coverage is 60.24096% with 33 lines in your changes missing coverage. Please review.

Project coverage is 87.70%. Comparing base (598dc4e) to head (b3f709e).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
lib/ex_webrtc/peer_connection.ex 51.28% 19 Missing ⚠️
lib/ex_webrtc/dtls_transport.ex 71.42% 8 Missing ⚠️
lib/ex_webrtc/sctp_transport.ex 57.14% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #218      +/-   ##
==========================================
- Coverage   88.06%   87.70%   -0.37%     
==========================================
  Files          50       50              
  Lines        2623     2684      +61     
==========================================
+ Hits         2310     2354      +44     
- Misses        313      330      +17     
Files with missing lines Coverage Δ
lib/ex_webrtc/ice_transport.ex 87.50% <100.00%> (+7.50%) ⬆️
lib/ex_webrtc/rtp_transceiver.ex 91.04% <ø> (ø)
test/support/test_utils.ex 85.71% <100.00%> (ø)
lib/ex_webrtc/sctp_transport.ex 82.32% <57.14%> (-0.92%) ⬇️
lib/ex_webrtc/dtls_transport.ex 84.56% <71.42%> (-0.44%) ⬇️
lib/ex_webrtc/peer_connection.ex 85.62% <51.28%> (-1.04%) ⬇️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 598dc4e...b3f709e. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mickel8 mickel8 force-pushed the close-notify branch 4 times, most recently from 0cbfc51 to 2c37359 Compare June 6, 2025 11:44
@mickel8 mickel8 force-pushed the close-notify branch 3 times, most recently from 6675529 to e9766cf Compare June 10, 2025 17:47
@mickel8 mickel8 changed the title Handle DTLS close_notify alert Add close/1. Handle DTLS close_notify alert Jun 10, 2025
@mickel8 mickel8 force-pushed the close-notify branch 5 times, most recently from cd63edc to 953101a Compare June 11, 2025 16:57
@mickel8 mickel8 force-pushed the close-notify branch 13 times, most recently from 20002ce to a74f66d Compare June 12, 2025 18:36
@mickel8 mickel8 force-pushed the close-notify branch 2 times, most recently from 1264224 to 0df50e4 Compare June 12, 2025 19:04
@mickel8 mickel8 marked this pull request as ready for review June 12, 2025 19:12
@mickel8 mickel8 requested review from PiotrWodecki and Karolk99 June 12, 2025 19:13
@PiotrWodecki PiotrWodecki removed their request for review June 16, 2025 09:05
@mickel8 mickel8 merged commit 9cdd430 into master Jun 16, 2025
3 of 4 checks passed
@mickel8 mickel8 deleted the close-notify branch June 16, 2025 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add closed PeerConnection signalling state
2 participants