Skip to content

Commit 8e66f55

Browse files
committed
More logs
1 parent abf2933 commit 8e66f55

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

Sources/LiveKit/Core/Room+Engine.swift

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,13 @@ extension Room {
318318

319319
log("[Connect] Waiting for subscriber to connect...")
320320
// Wait for primary transport to connect (if not already)
321-
try await primaryTransportConnectedCompleter.wait(timeout: _state.connectOptions.primaryTransportConnectTimeout)
321+
do {
322+
try await primaryTransportConnectedCompleter.wait(timeout: _state.connectOptions.primaryTransportConnectTimeout)
323+
log("[Connect] Subscriber transport connected")
324+
} catch {
325+
log("[Connect] Subscriber transport failed to connect, error: \(error)", .error)
326+
throw error
327+
}
322328
try Task.checkCancellation()
323329

324330
// send SyncState before offer
@@ -330,7 +336,13 @@ extension Room {
330336
// Only if published, wait for publisher to connect...
331337
log("[Connect] Waiting for publisher to connect...")
332338
try await publisher.createAndSendOffer(iceRestart: true)
333-
try await publisherTransportConnectedCompleter.wait(timeout: _state.connectOptions.publisherTransportConnectTimeout)
339+
do {
340+
try await publisherTransportConnectedCompleter.wait(timeout: _state.connectOptions.publisherTransportConnectTimeout)
341+
log("[Connect] Publisher transport connected")
342+
} catch {
343+
log("[Connect] Publisher transport failed to connect, error: \(error)", .error)
344+
throw error
345+
}
334346
}
335347
}
336348

Sources/LiveKit/Core/Room+SignalClientDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ extension Room: SignalClientDelegate {
322322
}
323323

324324
func signalClient(_: SignalClient, didReceiveAnswer answer: LKRTCSessionDescription, offerId: UInt32) async {
325-
log("Received answer with offerId: \(offerId)")
325+
log("Received answer for offerId: \(offerId)")
326326

327327
do {
328328
let publisher = try requirePublisher()
@@ -346,7 +346,7 @@ extension Room: SignalClientDelegate {
346346
try await subscriber.set(localDescription: answer)
347347
try await signalClient.send(answer: answer, offerId: offerId)
348348
} catch {
349-
log("Failed to send answer with offerId: \(offerId), error: \(error)", .error)
349+
log("Failed to send answer for offerId: \(offerId), error: \(error)", .error)
350350
}
351351
}
352352

Sources/LiveKit/Core/SignalClient.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,15 @@ actor SignalClient: Loggable {
126126
participantSid: participantSid,
127127
adaptiveStream: adaptiveStream)
128128

129-
if reconnectMode != nil {
130-
log("[Connect] with url: \(url)")
129+
let isReconnect = reconnectMode != nil
130+
131+
if isReconnect {
132+
log("Reconnecting with url: \(url)")
131133
} else {
132134
log("Connecting with url: \(url)")
133135
}
134136

135-
_state.mutate { $0.connectionState = (reconnectMode != nil ? .reconnecting : .connecting) }
137+
_state.mutate { $0.connectionState = (isReconnect ? .reconnecting : .connecting) }
136138

137139
do {
138140
let socket = try await WebSocket(url: url,

0 commit comments

Comments
 (0)