Export CloseSignalConnection (#936)
* Export CloseSignalConnection There are a few places where that close pattern is repeated. Export it and use that function in other places directly. * fix test
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/livekit/livekit-server/pkg/routing"
|
||||
)
|
||||
|
||||
func (p *ParticipantImpl) GetResponseSink() routing.MessageSink {
|
||||
func (p *ParticipantImpl) getResponseSink() routing.MessageSink {
|
||||
if !p.resSinkValid.Load() {
|
||||
return nil
|
||||
}
|
||||
@@ -174,7 +174,7 @@ func (p *ParticipantImpl) writeMessage(msg *livekit.SignalResponse) error {
|
||||
if p.State() == livekit.ParticipantInfo_DISCONNECTED {
|
||||
return nil
|
||||
}
|
||||
sink := p.GetResponseSink()
|
||||
sink := p.getResponseSink()
|
||||
if sink == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -188,9 +188,10 @@ func (p *ParticipantImpl) writeMessage(msg *livekit.SignalResponse) error {
|
||||
}
|
||||
|
||||
// closes signal connection to notify client to resume/reconnect
|
||||
func (p *ParticipantImpl) closeSignalConnection() {
|
||||
sink := p.GetResponseSink()
|
||||
func (p *ParticipantImpl) CloseSignalConnection() {
|
||||
sink := p.getResponseSink()
|
||||
if sink != nil {
|
||||
p.params.Logger.Infow("closing signal connection")
|
||||
sink.Close()
|
||||
p.SetResponseSink(nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user