Accept LZO regardless of framing

This commit is contained in:
Davide De Rosa 2019-03-19 23:17:04 +01:00
parent 9a6f3d638c
commit 4b9ffcfb4e
2 changed files with 10 additions and 10 deletions

View File

@ -117,7 +117,7 @@
[self.decrypter setPeerId:peerId];
[self setCompressionFraming:compressionFraming];
if (LZOIsSupported() && (compressionFraming == CompressionFramingNativeCompLZO) && (compressionAlgorithm == CompressionAlgorithmNativeLZO)) {
if (LZOIsSupported() && (compressionAlgorithm == CompressionAlgorithmNativeLZO)) {
self.lzo = LZOCreate();
}
}

View File

@ -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 {