Skip to content

Commit

Permalink
minor DataChannelPair clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroshihorie committed Oct 30, 2023
1 parent 4b8468c commit c1cd410
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Sources/LiveKit/Core/DataChannelPair.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ internal class DataChannelPair: NSObject, Loggable {

public var isOpen: Bool {

guard let r = _reliableChannel,
let l = _lossyChannel else {
guard let reliable = _reliableChannel,
let lossy = _lossyChannel else {
return false
}

return .open == r.readyState && .open == l.readyState
return .open == reliable.readyState && .open == lossy.readyState
}

public init(target: Livekit_SignalTarget,
Expand Down Expand Up @@ -74,8 +74,8 @@ internal class DataChannelPair: NSObject, Loggable {

public func close() -> Promise<Void> {

let r = _reliableChannel
let l = _lossyChannel
let reliable = _reliableChannel
let lossy = _lossyChannel

_reliableChannel = nil
_lossyChannel = nil
Expand All @@ -86,8 +86,8 @@ internal class DataChannelPair: NSObject, Loggable {

// execute on .webRTC queue
return Promise(on: .liveKitWebRTC) {
r?.close()
l?.close()
reliable?.close()
lossy?.close()
}
}

Expand Down

0 comments on commit c1cd410

Please sign in to comment.