From 895d56d4ce43c10e6b7a8635e260ea3720706f97 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 11 Feb 2013 09:32:53 +0800 Subject: [PATCH] remove minimum frame size for deflate The idea here seems wrong, if we have a mixture of frames of varying sizes above and below the limit, we segfault in deflate after skipping it once. If the protocol doesn't want compression because many frames are small, it should veto the extension in the user callback. If only a few frames are tiny, the overhead for compressing it all is tiny. Signed-off-by: Andy Green --- changelog | 6 ++++++ lib/extension-deflate-frame.c | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/changelog b/changelog index 820310b4..a6e0b587 100644 --- a/changelog +++ b/changelog @@ -79,6 +79,12 @@ the visual studio project files that were in the tree until now. and no -g (debug info), obviously providing best performance and reduced binary size. + - 1.0 introduced some code to try to not deflate small frames, however this + seems to break when confronted with a mixture of frames above and + below the threshold, so it's removed. Veto the compression extension + in your user callback if you will typically have very small frames. + + v1.1-chrome26-firefox18 ======================= diff --git a/lib/extension-deflate-frame.c b/lib/extension-deflate-frame.c index 846f7d1f..36e025a5 100644 --- a/lib/extension-deflate-frame.c +++ b/lib/extension-deflate-frame.c @@ -7,8 +7,6 @@ #define LWS_ZLIB_WINDOW_BITS 15 #define LWS_ZLIB_MEMLEVEL 8 -#define MIN_SIZE_TO_DEFLATE 4 - int lws_extension_callback_deflate_frame( struct libwebsocket_context *context, struct libwebsocket_extension *ext, @@ -211,9 +209,6 @@ bail: */ current_payload = eff_buf->token_len; - if (current_payload < MIN_SIZE_TO_DEFLATE) - return 0; - conn->zs_out.next_in = (unsigned char *)eff_buf->token; conn->zs_out.avail_in = current_payload;