From 4b9ffcfb4e8cd43419a657eb5f6a7193728354ed Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Tue, 19 Mar 2019 23:17:04 +0100 Subject: [PATCH] Accept LZO regardless of framing --- TunnelKit/Sources/Core/DataPath.m | 2 +- TunnelKit/Sources/Core/SessionProxy.swift | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/TunnelKit/Sources/Core/DataPath.m b/TunnelKit/Sources/Core/DataPath.m index 2af19c9..5f64e7c 100644 --- a/TunnelKit/Sources/Core/DataPath.m +++ b/TunnelKit/Sources/Core/DataPath.m @@ -117,7 +117,7 @@ [self.decrypter setPeerId:peerId]; [self setCompressionFraming:compressionFraming]; - if (LZOIsSupported() && (compressionFraming == CompressionFramingNativeCompLZO) && (compressionAlgorithm == CompressionAlgorithmNativeLZO)) { + if (LZOIsSupported() && (compressionAlgorithm == CompressionAlgorithmNativeLZO)) { self.lzo = LZOCreate(); } } diff --git a/TunnelKit/Sources/Core/SessionProxy.swift b/TunnelKit/Sources/Core/SessionProxy.swift index 59358ee..366daa0 100644 --- a/TunnelKit/Sources/Core/SessionProxy.swift +++ b/TunnelKit/Sources/Core/SessionProxy.swift @@ -912,20 +912,20 @@ public class SessionProxy { reply = optionalReply log.debug("Received PUSH_REPLY: \"\(reply.maskedDescription)\"") - if let framing = reply.compressionFraming, let compression = reply.compressionAlgorithm, compression != .disabled { - switch framing { - case .compress: - log.error("Server has new compression enabled and this is currently unsupported (\(framing))") - throw SessionError.serverCompression + if let framing = reply.compressionFraming, let compression = reply.compressionAlgorithm { + switch compression { + case .disabled: + break - case .compLZO: + case .LZO: if !LZOIsSupported() { - log.error("Server has legacy LZO compression enabled and this was not built into the library (\(framing))") + log.error("Server has LZO compression enabled and this was not built into the library (framing=\(framing))") throw SessionError.serverCompression } - default: - break + case .other: + log.error("Server has non-LZO compression enabled and this is currently unsupported (framing=\(framing))") + throw SessionError.serverCompression } } } catch let e {