Skip to content

Commit

Permalink
remove unnecessary async
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroshihorie committed Dec 4, 2023
1 parent 2832f26 commit d4044d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Sources/LiveKit/Core/Engine+SignalClientDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extension Engine: SignalClientDelegate {
func signalClient(_: SignalClient, didReceiveAnswer answer: LKRTCSessionDescription) {
Task {
do {
let publisher = try await requirePublisher()
let publisher = try requirePublisher()
try await publisher.set(remoteDescription: answer)
} catch {
log("Failed to set remote description, error: \(error)", .error)
Expand Down
16 changes: 8 additions & 8 deletions Sources/LiveKit/Core/Engine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class Engine: MulticastDelegate<EngineDelegate> {
// cleanUp (reset) both Room & Engine's state
func cleanUp(reason: DisconnectReason? = nil, isFullReconnect: Bool = false) async throws {
// This should never happen since Engine is owned by Room
let room = try await requireRoom()
let room = try requireRoom()
// Call Room's cleanUp
await room.cleanUp(reason: reason, isFullReconnect: isFullReconnect)
}
Expand All @@ -198,7 +198,7 @@ class Engine: MulticastDelegate<EngineDelegate> {
func publisherShouldNegotiate() async throws {
log()

let publisher = try await requirePublisher()
let publisher = try requirePublisher()
publisher.negotiate()
_state.mutate { $0.hasPublished = true }
}
Expand All @@ -207,7 +207,7 @@ class Engine: MulticastDelegate<EngineDelegate> {
func ensurePublisherConnected() async throws {
guard subscriberPrimary else { return }

let publisher = try await requirePublisher()
let publisher = try requirePublisher()

if !publisher.isConnected, publisher.connectionState != .connecting {
try await publisherShouldNegotiate()
Expand Down Expand Up @@ -341,7 +341,7 @@ extension Engine {
// full connect sequence, doesn't update connection state
func fullConnectSequence(_ url: String, _ token: String) async throws {
// This should never happen since Engine is owned by Room
let room = try await requireRoom()
let room = try requireRoom()

let jr = try await signalClient.connect(url,
token,
Expand Down Expand Up @@ -383,7 +383,7 @@ extension Engine {
log("[Reconnect] Starting .quick reconnect sequence...")

// This should never happen since Engine is owned by Room
let room = try await requireRoom()
let room = try requireRoom()

try await signalClient.connect(url,
token,
Expand Down Expand Up @@ -477,7 +477,7 @@ extension Engine {

extension Engine {
func sendSyncState() async throws {
let room = try await requireRoom()
let room = try requireRoom()

guard let subscriber,
let previousAnswer = subscriber.localDescription
Expand Down Expand Up @@ -518,12 +518,12 @@ extension Engine {
// MARK: - Private helpers

extension Engine {
func requireRoom() async throws -> Room {
func requireRoom() throws -> Room {
guard let room = _room else { throw EngineError.state(message: "Room is nil") }
return room
}

func requirePublisher() async throws -> Transport {
func requirePublisher() throws -> Transport {
guard let publisher else { throw EngineError.state(message: "Publisher is nil") }
return publisher
}
Expand Down

0 comments on commit d4044d9

Please sign in to comment.