Skip to content

Commit

Permalink
ConnectionState logging support
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroshihorie committed Apr 22, 2024
1 parent 25d504b commit ad06bdf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/LiveKit/Core/Engine+TransportDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extension RTCPeerConnectionState {

extension Engine: TransportDelegate {
func transport(_ transport: Transport, didUpdateState pcState: RTCPeerConnectionState) async {
log("target: \(transport.target), state: \(pcState)")
log("target: \(transport.target), connectionState: \(pcState.description)")

// primary connected
if transport.isPrimary {
Expand Down
11 changes: 11 additions & 0 deletions Sources/LiveKit/Extensions/CustomStringConvertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ extension RTCPeerConnectionState {
}
}

extension ConnectionState: CustomStringConvertible {
public var description: String {
switch self {
case .disconnected: ".disconnected"
case .connecting: ".connecting"
case .reconnecting: ".reconnecting"
case .connected: ".connected"
}
}
}

extension ReconnectMode: CustomStringConvertible {
public var description: String {
switch self {
Expand Down

0 comments on commit ad06bdf

Please sign in to comment.