mirror of
https://github.com/livekit/livekit.git
synced 2026-03-30 15:35:41 +00:00
Do not process events after participant close. (#1824)
* Do not process events after participant close. Avoid processing transport events after participant/transport close. It causes error logs which are not really errors, but distracting noise. * correct comment
This commit is contained in:
@@ -538,6 +538,10 @@ func (p *ParticipantImpl) HandleAnswer(answer webrtc.SessionDescription) {
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) onPublisherAnswer(answer webrtc.SessionDescription) error {
|
||||
if p.IsClosed() || p.IsDisconnected() {
|
||||
return nil
|
||||
}
|
||||
|
||||
p.params.Logger.Debugw("sending answer", "transport", livekit.SignalTarget_PUBLISHER)
|
||||
answer = p.configurePublisherAnswer(answer)
|
||||
if err := p.writeMessage(&livekit.SignalResponse{
|
||||
@@ -1290,7 +1294,7 @@ func (p *ParticipantImpl) onDataMessage(kind livekit.DataPacket_Kind, data []byt
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) onICECandidate(c *webrtc.ICECandidate, target livekit.SignalTarget) error {
|
||||
if c == nil || p.IsDisconnected() {
|
||||
if c == nil || p.IsDisconnected() || p.IsClosed() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1370,6 +1370,11 @@ func (t *PCTransport) postEvent(event event) {
|
||||
|
||||
func (t *PCTransport) processEvents() {
|
||||
for event := range t.eventCh {
|
||||
if t.isClosed.Load() {
|
||||
// just drain the channel without processing events
|
||||
continue
|
||||
}
|
||||
|
||||
err := t.handleEvent(&event)
|
||||
if err != nil {
|
||||
t.params.Logger.Errorw("error handling event", err, "event", event.String())
|
||||
|
||||
Reference in New Issue
Block a user