From 4a52065a55b119dc20b106165aeb141dd1fcfa43 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 1 Jan 2016 16:35:28 +1100 Subject: [PATCH] Only send packets compressed if they're smaller --- src/ckpool.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ckpool.c b/src/ckpool.c index a5a41108..35839db8 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -744,6 +744,12 @@ int write_cs(connsock_t *cs, const char *buf, int len) ret = write_socket(cs->fd, buf, len); goto out; } + if (compsize + 12 >= len) { + /* Selectively send compressed packets only when they're + * smaller. */ + ret = write_socket(cs->fd, buf, len); + goto out; + } LOGDEBUG("Writing connsock message compressed %d from %d", compsize, decompsize); /* Copy lz4 magic header */ sprintf(dest, "lz4\n");