Log and return error on no response sink. (#937)

* Log and return error on no response sink.

* Clean up
This commit is contained in:
Raja Subramanian
2022-08-21 22:36:59 +05:30
committed by GitHub
parent 70422c0267
commit a600dfc9e3

View File

@@ -174,10 +174,15 @@ func (p *ParticipantImpl) writeMessage(msg *livekit.SignalResponse) error {
if p.State() == livekit.ParticipantInfo_DISCONNECTED {
return nil
}
sink := p.getResponseSink()
if sink == nil {
return nil
err := fmt.Errorf("no response sink")
p.params.Logger.Warnw("could not send message to participant", err,
"message", fmt.Sprintf("%T", msg.Message))
return err
}
err := sink.WriteMessage(msg)
if err != nil {
p.params.Logger.Warnw("could not send message to participant", err,