File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed
Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -636,16 +636,31 @@ internal extension SignalClient {
636636 func sendSimulate( scenario: SimulateScenario ) -> Promise < Void > {
637637 log ( )
638638
639+ var shouldDisconnect = false
640+
639641 let r = Livekit_SignalRequest . with {
640642 $0. simulate = Livekit_SimulateScenario . with {
641- if case . nodeFailure = scenario { $0. nodeFailure = true }
642- if case . migration = scenario { $0. migration = true }
643- if case . serverLeave = scenario { $0. serverLeave = true }
644- if case . speakerUpdate( let secs) = scenario { $0. speakerUpdate = Int32 ( secs) }
643+ switch scenario {
644+ case . nodeFailure: $0. nodeFailure = true
645+ case . migration: $0. migration = true
646+ case . serverLeave: $0. serverLeave = true
647+ case . speakerUpdate( let secs) : $0. speakerUpdate = Int32 ( secs)
648+ case . forceTCP:
649+ $0. switchCandidateProtocol = Livekit_CandidateProtocol . tcp
650+ shouldDisconnect = true
651+ case . forceTLS:
652+ $0. switchCandidateProtocol = Livekit_CandidateProtocol . tls
653+ shouldDisconnect = true
654+ }
645655 }
646656 }
647657
648- return sendRequest ( r)
658+ return sendRequest ( r) . then ( on: queue) {
659+ if shouldDisconnect {
660+ let sdkError = NetworkError . disconnected ( message: " Simulate scenario " )
661+ self . cleanUp ( reason: . networkError( sdkError) )
662+ }
663+ }
649664 }
650665
651666 @discardableResult
Original file line number Diff line number Diff line change @@ -44,4 +44,6 @@ public enum SimulateScenario {
4444 case migration
4545 case serverLeave
4646 case speakerUpdate( seconds: Int )
47+ case forceTCP
48+ case forceTLS
4749}
You can’t perform that action at this time.
0 commit comments