1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

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 <andy.green@linaro.org>
This commit is contained in:
Andy Green 2013-02-11 09:32:53 +08:00
parent a3957ef804
commit 895d56d4ce
2 changed files with 6 additions and 5 deletions

View file

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

View file

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