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:
@@ -1458,10 +1458,6 @@ func (h AnyTransportHandler) OnFailed(_isShortLived bool, _ici *types.ICEConnect
|
||||
h.p.onAnyTransportFailed()
|
||||
}
|
||||
|
||||
func (h AnyTransportHandler) OnClosed() {
|
||||
h.p.onAnyTransportClosed()
|
||||
}
|
||||
|
||||
func (h AnyTransportHandler) OnNegotiationFailed() {
|
||||
h.p.onAnyTransportNegotiationFailed()
|
||||
}
|
||||
@@ -2037,10 +2033,6 @@ func (p *ParticipantImpl) onAnyTransportFailed() {
|
||||
p.setupDisconnectTimer()
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) onAnyTransportClosed() {
|
||||
_ = p.Close(false, types.ParticipantCloseReasonPeerConnectionDisconnected, false)
|
||||
}
|
||||
|
||||
// subscriberRTCPWorker sends SenderReports periodically when the participant is subscribed to
|
||||
// other publishedTracks in the room.
|
||||
func (p *ParticipantImpl) subscriberRTCPWorker() {
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ type Handler interface {
|
||||
OnInitialConnected()
|
||||
OnFullyEstablished()
|
||||
OnFailed(isShortLived bool, iceConnectionInfo *types.ICEConnectionInfo)
|
||||
OnClosed()
|
||||
OnTrack(track *webrtc.TrackRemote, rtpReceiver *webrtc.RTPReceiver)
|
||||
OnDataPacket(kind livekit.DataPacket_Kind, data []byte)
|
||||
OnDataSendError(err error)
|
||||
|
||||
@@ -23,10 +23,6 @@ type FakeHandler struct {
|
||||
onAnswerReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
OnClosedStub func()
|
||||
onClosedMutex sync.RWMutex
|
||||
onClosedArgsForCall []struct {
|
||||
}
|
||||
OnDataPacketStub func(livekit.DataPacket_Kind, []byte)
|
||||
onDataPacketMutex sync.RWMutex
|
||||
onDataPacketArgsForCall []struct {
|
||||
@@ -166,30 +162,6 @@ func (fake *FakeHandler) OnAnswerReturnsOnCall(i int, result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeHandler) OnClosed() {
|
||||
fake.onClosedMutex.Lock()
|
||||
fake.onClosedArgsForCall = append(fake.onClosedArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.OnClosedStub
|
||||
fake.recordInvocation("OnClosed", []interface{}{})
|
||||
fake.onClosedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnClosedStub()
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeHandler) OnClosedCallCount() int {
|
||||
fake.onClosedMutex.RLock()
|
||||
defer fake.onClosedMutex.RUnlock()
|
||||
return len(fake.onClosedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeHandler) OnClosedCalls(stub func()) {
|
||||
fake.onClosedMutex.Lock()
|
||||
defer fake.onClosedMutex.Unlock()
|
||||
fake.OnClosedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeHandler) OnDataPacket(arg1 livekit.DataPacket_Kind, arg2 []byte) {
|
||||
var arg2Copy []byte
|
||||
if arg2 != nil {
|
||||
@@ -619,8 +591,6 @@ func (fake *FakeHandler) Invocations() map[string][][]interface{} {
|
||||
defer fake.invocationsMutex.RUnlock()
|
||||
fake.onAnswerMutex.RLock()
|
||||
defer fake.onAnswerMutex.RUnlock()
|
||||
fake.onClosedMutex.RLock()
|
||||
defer fake.onClosedMutex.RUnlock()
|
||||
fake.onDataPacketMutex.RLock()
|
||||
defer fake.onDataPacketMutex.RUnlock()
|
||||
fake.onDataSendErrorMutex.RLock()
|
||||
|
||||
Reference in New Issue
Block a user