Disable close by dtls to fix migration (#3220)

Pion v4 imports new feature that will close
peerconnection on dtls.close to detects
remote peer closed quickly, it breaks the
session migration.
This commit is contained in:
cnderrauber
2024-11-30 09:20:45 +08:00
committed by GitHub
parent 44d26f0cb4
commit c76fb0bcf4
6 changed files with 7 additions and 47 deletions
+4 -5
View File
@@ -285,6 +285,10 @@ func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimat
// https://github.com/pion/dtls/pull/474
se.SetDTLSEllipticCurves(elliptic.X25519, elliptic.P384, elliptic.P256)
// Disable close by dtls to avoid peerconnection close too early in migration
// https://github.com/pion/webrtc/pull/2961
se.DisableCloseByDTLS(true)
//
// Disable SRTP replay protection (https://datatracker.ietf.org/doc/html/rfc3711#page-15).
// Needed due to lack of RTX stream support in Pion.
@@ -706,11 +710,6 @@ func (t *PCTransport) onPeerConnectionStateChange(state webrtc.PeerConnectionSta
case webrtc.PeerConnectionStateFailed:
t.clearConnTimer()
t.handleConnectionFailed(false)
case webrtc.PeerConnectionStateClosed:
// peerconnection closed by client
if !t.isClosed.Load() {
t.params.Handler.OnClosed()
}
}
}