From f2000aa1dae2c6b4ca22ad6c52cd42c53d5f5cbd Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 22 Dec 2018 02:21:07 +0100 Subject: [PATCH] Combine double log invocations Signed-off-by: Jason A. Donenfeld --- WireGuard/WireGuard/Tunnel/TunnelsManager.swift | 6 ++---- .../WireGuardNetworkExtension/PacketTunnelProvider.swift | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift index bf5ab52..4913fd2 100644 --- a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift +++ b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift @@ -395,8 +395,7 @@ class TunnelContainer: NSObject { activationDelegate?.tunnelActivationAttemptFailed(tunnel: self, error: .failedWhileSaving(systemError: error!)) return } - wg_log(.debug, staticMessage: "startActivation: Tunnel saved after re-enabling") - wg_log(.debug, staticMessage: "startActivation: Invoking startActivation") + wg_log(.debug, staticMessage: "startActivation: Tunnel saved after re-enabling, invoking startActivation") self.startActivation(recursionCount: recursionCount + 1, lastError: NEVPNError(NEVPNError.configurationUnknown), activationDelegate: activationDelegate) } return @@ -434,8 +433,7 @@ class TunnelContainer: NSObject { activationDelegate?.tunnelActivationAttemptFailed(tunnel: self, error: .failedWhileLoading(systemError: systemError)) return } - wg_log(.debug, staticMessage: "startActivation: Tunnel reloaded") - wg_log(.debug, staticMessage: "startActivation: Invoking startActivation") + wg_log(.debug, staticMessage: "startActivation: Tunnel reloaded, invoking startActivation") self.startActivation(recursionCount: recursionCount + 1, lastError: systemError, activationDelegate: activationDelegate) } } diff --git a/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift b/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift index 7a461c4..bcec9b2 100644 --- a/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift +++ b/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift @@ -66,7 +66,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider { let handle = wireguardSettings.withGoString { return wgTurnOn($0, fileDescriptor) } if handle < 0 { - wg_log(.error, staticMessage: "Starting tunnel failed: Could not start WireGuard") + wg_log(.error, message: "Starting tunnel failed with wgTurnOn returning \(handle)") errorNotifier.notify(PacketTunnelProviderError.couldNotStartWireGuard) startTunnelCompletionHandler(PacketTunnelProviderError.couldNotStartWireGuard) return @@ -76,8 +76,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider { let networkSettings: NEPacketTunnelNetworkSettings = packetTunnelSettingsGenerator!.generateNetworkSettings() setTunnelNetworkSettings(networkSettings) { error in if let error = error { - wg_log(.error, staticMessage: "Starting tunnel failed: Error setting network settings.") - wg_log(.error, message: "Error from setTunnelNetworkSettings: \(error.localizedDescription)") + wg_log(.error, message: "Starting tunnel failed with setTunnelNetworkSettings returning \(error.localizedDescription)") errorNotifier.notify(PacketTunnelProviderError.coultNotSetNetworkSettings) startTunnelCompletionHandler(PacketTunnelProviderError.coultNotSetNetworkSettings) } else {