update comments in compression extensions [skip ci]

fixes #14
This commit is contained in:
jangko 2021-06-21 14:01:51 +07:00
parent 5a93ad7867
commit e56447dda3
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
1 changed files with 13 additions and 9 deletions

View File

@ -24,7 +24,7 @@ type
# should not be compressed.
level: ZLevel # compression level
strategy: ZStrategy # compression strategy
memLevel: ZMemLevel # hint for miniz memory consumption
memLevel: ZMemLevel # hint for zlib memory consumption
serverNoContextTakeOver: bool
clientNoContextTakeOver: bool
serverMaxWindowBits: int
@ -140,13 +140,15 @@ proc getContextTakeover(opts: DeflateOpts, isServer: bool): bool =
opts.clientNoContextTakeOver
proc decompressInit(ext: DeflateExt) =
# decompression using `client_` prefixed config
# server decompression using `client_` prefixed config
# client decompression using `server_` prefixed config
let windowBits = getWindowBits(ext.opts, not ext.opts.isServer)
doAssert(ext.decompCtx.inflateInit2(windowBits) == Z_OK)
ext.decompCtxState = ContextState.Initialized
proc compressInit(ext: DeflateExt) =
# compression using `server_` prefixed config
# server compression using `server_` prefixed config
# client compression using `client_` prefixed config
let windowBits = getWindowBits(ext.opts, ext.opts.isServer)
doAssert(ext.compCtx.deflateInit2(
level = ext.opts.level,
@ -261,7 +263,8 @@ method decode(ext: DeflateExt, frame: Frame): Future[Frame] {.async.} =
frame.mask = false # clear mask flag, decompressed content is not masked
if frame.fin:
# decompression using `client_` prefixed config
# server decompression using `client_` prefixed config
# client decompression using `server_` prefixed config
let noContextTakeover = getContextTakeover(ext.opts, not ext.opts.isServer)
if noContextTakeover:
doAssert(ext.decompCtx.inflateReset() == Z_OK)
@ -308,7 +311,8 @@ method encode(ext: DeflateExt, frame: Frame): Future[Frame] {.async.} =
frame.consumed = 0
if frame.fin:
# compression using `server_` prefixed config
# server compression using `server_` prefixed config
# client compression using `client_` prefixed config
let noContextTakeover = getContextTakeover(ext.opts, ext.opts.isServer)
if noContextTakeover:
doAssert(ext.compCtx.deflateReset() == Z_OK)