fallback to turn over tls when tcp short connection happen (#950)

* fallback to tls when tcp failed

* go mod

* magefile
This commit is contained in:
cnderrauber
2022-08-24 20:42:56 +08:00
committed by GitHub
parent 00b131da50
commit 1350400c3a
8 changed files with 68 additions and 32 deletions
+10 -2
View File
@@ -233,6 +233,8 @@ func (p *ParticipantImpl) ConnectedAt() time.Time {
}
func (p *ParticipantImpl) GetClientConfiguration() *livekit.ClientConfiguration {
p.lock.RLock()
defer p.lock.RUnlock()
return p.params.ClientConf
}
@@ -1035,9 +1037,15 @@ func (p *ParticipantImpl) setupTransportManager() error {
}
tm.OnICEConfigChanged(func(iceConfig types.IceConfig) {
p.lock.RLock()
p.lock.Lock()
onICEConfigChanged := p.onICEConfigChanged
p.lock.RUnlock()
if iceConfig.PreferSub == types.PreferTls {
if p.params.ClientConf == nil {
p.params.ClientConf = &livekit.ClientConfiguration{}
}
p.params.ClientConf.ForceRelay = livekit.ClientConfigSetting_ENABLED
}
p.lock.Unlock()
if onICEConfigChanged != nil {
onICEConfigChanged(p, iceConfig)