Update pion/webrtc to prevent GetStats panic. (#4004)

Also, closing all data channels before closing peer connection.
This commit is contained in:
Raja Subramanian
2025-10-15 13:11:14 +05:30
committed by GitHub
parent 7930dcde25
commit fe912acf37
3 changed files with 33 additions and 33 deletions
+6 -6
View File
@@ -1445,18 +1445,14 @@ func (t *PCTransport) Close() {
t.pacer.Stop()
}
t.clearConnTimer()
t.lock.Lock()
if t.mayFailedICEStatsTimer != nil {
t.mayFailedICEStatsTimer.Stop()
t.mayFailedICEStatsTimer = nil
}
t.lock.Unlock()
_ = t.pc.Close()
t.clearConnTimer()
t.lock.Lock()
if t.reliableDC != nil {
t.reliableDC.Close()
t.reliableDC = nil
@@ -1473,16 +1469,20 @@ func (t *PCTransport) Close() {
t.unlabeledDataChannels = nil
t.lock.Unlock()
_ = t.pc.Close()
t.outputAndClearICEStats()
}
func (t *PCTransport) clearConnTimer() {
t.lock.Lock()
defer t.lock.Unlock()
if t.connectAfterICETimer != nil {
t.connectAfterICETimer.Stop()
t.connectAfterICETimer = nil
}
if t.tcpICETimer != nil {
t.tcpICETimer.Stop()
t.tcpICETimer = nil