let panics crash

This commit is contained in:
danm
2023-02-07 15:06:15 -07:00
parent 2393a559c4
commit 8027cccadd
4 changed files with 1 additions and 29 deletions
-4
View File
@@ -1054,7 +1054,6 @@ func (p *ParticipantImpl) updateState(state livekit.ParticipantInfo_State) {
p.lock.RUnlock()
if onStateChange != nil {
go func() {
defer Recover(p.GetLogger())
onStateChange(p, oldState)
}()
}
@@ -1228,7 +1227,6 @@ 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())
for {
if p.IsDisconnected() {
return
@@ -1821,8 +1819,6 @@ func (p *ParticipantImpl) getPublishedTrackBySdpCid(clientId string) types.Media
}
func (p *ParticipantImpl) publisherRTCPWorker() {
defer Recover(p.GetLogger())
// read from rtcpChan
for pkts := range p.rtcpCh {
if pkts == nil {
-23
View File
@@ -2,7 +2,6 @@ package rtc
import (
"encoding/json"
"errors"
"io"
"strings"
@@ -108,28 +107,6 @@ func IsEOF(err error) bool {
return err == io.ErrClosedPipe || err == io.EOF
}
func RecoverSilent() {
recover()
}
func Recover(l logger.Logger) {
if l == nil {
l = logger.GetLogger()
}
if r := recover(); r != nil {
var err error
switch e := r.(type) {
case string:
err = errors.New(e)
case error:
err = e
default:
err = errors.New("unknown panic")
}
l.Errorw("recovered panic", err, "panic", r)
}
}
// logger helpers
func LoggerWithParticipant(l logger.Logger, identity livekit.ParticipantIdentity, sid livekit.ParticipantID, isRemote bool) logger.Logger {
values := make([]interface{}, 0, 4)
-1
View File
@@ -479,7 +479,6 @@ func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.LocalPa
pLogger.Debugw("RTC session finishing")
requestSource.Close()
}()
defer rtc.Recover(pLogger)
// send first refresh for cases when client token is close to expiring
_ = r.refreshToken(participant)
+1 -1
View File
@@ -263,7 +263,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// we would terminate the signal connection as well
_ = conn.Close()
}()
defer rtc.Recover(pLogger)
for {
select {
case <-done: