Skip to content

feat(dtls): add restart() for DTLS re-handshake after ICE restart#82

Open
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Brainwires:feat/dtls-restart
Open

feat(dtls): add restart() for DTLS re-handshake after ICE restart#82
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Brainwires:feat/dtls-restart

Conversation

@nightness
Copy link
Copy Markdown

Summary

  • Add DTLSTransport::restart() method to trigger a full DTLS re-handshake
  • Integrates with ICE restart detection in SDP negotiation
  • Allows recovery from DTLS session failure without tearing down the peer connection
  • Regenerates DTLS credentials on restart as required by RFC 8842

Test plan

  • cargo test -p rtc dtls
  • Verify that calling restart() triggers a new DTLS handshake
  • Verify ICE restart path correctly invokes DTLS restart

🤖 Generated with Claude Code

… on ICE restart

When ICE restarts the underlying path can change while the DTLS session
stays alive (RFC 8842: DTLS is not required to restart on ICE restart).
However, if the DTLS session was already Failed, Closed, or lost mid-
handshake before ICE re-establishes, the client-side connect() will never
fire again because dtls_handshake_config was consumed by the first
ICESelectedCandidatePairChange.

Changes:
- Refactor make_handshake_config() from prepare_transport() so the config
  can be rebuilt without the state==New guard
- Add DTLSTransport::restart(): no-ops if Connected (live session survives
  ICE restart transparently); replaces endpoint and restores
  dtls_handshake_config if state is Failed/Closed/Connecting-but-lost
- Call dtls_transport_mut().restart() from set_remote_description when ICE
  credentials change during renegotiation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant