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");