exit after panic (#1392)
* let panics crash * Revert "let panics crash" This reverts commit 8027cccadd760bd6588ba7a0c699f80b9fda1f09. * catch and log panics then os.Exit * Recover only recovers, caller can exit * only exit on pacic, still need Recover calls in goroutines
This commit is contained in:
+16
-3
@@ -3,6 +3,7 @@ package rtc
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -1054,7 +1055,11 @@ func (p *ParticipantImpl) updateState(state livekit.ParticipantInfo_State) {
|
||||
p.lock.RUnlock()
|
||||
if onStateChange != nil {
|
||||
go func() {
|
||||
defer Recover(p.GetLogger())
|
||||
defer func() {
|
||||
if r := Recover(p.GetLogger()); r != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}()
|
||||
onStateChange(p, oldState)
|
||||
}()
|
||||
}
|
||||
@@ -1228,7 +1233,11 @@ func (p *ParticipantImpl) onAnyTransportFailed() {
|
||||
// subscriberRTCPWorker sends SenderReports periodically when the participant is subscribed to
|
||||
// other publishedTracks in the room.
|
||||
func (p *ParticipantImpl) subscriberRTCPWorker() {
|
||||
defer Recover(p.GetLogger())
|
||||
defer func() {
|
||||
if r := Recover(p.GetLogger()); r != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}()
|
||||
for {
|
||||
if p.IsDisconnected() {
|
||||
return
|
||||
@@ -1821,7 +1830,11 @@ func (p *ParticipantImpl) getPublishedTrackBySdpCid(clientId string) types.Media
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) publisherRTCPWorker() {
|
||||
defer Recover(p.GetLogger())
|
||||
defer func() {
|
||||
if r := Recover(p.GetLogger()); r != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}()
|
||||
|
||||
// read from rtcpChan
|
||||
for pkts := range p.rtcpCh {
|
||||
|
||||
Reference in New Issue
Block a user