summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-11-28 19:51:44 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-11-28 19:51:44 +0100
commitdd65bd7e7d1e8e7f9f0ca517cecaec3bcceae375 (patch)
treede0f0c1164e0c7f8529097dbd1bb27d7fbeb37f1 /src
parentadc518a2063ee78e4217a8aba51b116af1af42f4 (diff)
Don't push the outbuf for zstd chunks on errors
Diffstat (limited to 'src')
-rw-r--r--src/ot_fullscrape.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ot_fullscrape.c b/src/ot_fullscrape.c
index 3e3b6cb..00c08e0 100644
--- a/src/ot_fullscrape.c
+++ b/src/ot_fullscrape.c
@@ -381,7 +381,7 @@ static void fullscrape_make_zstd(int taskid, ot_tasktype mode) {
381 381
382 /* Check if there still is enough buffer left */ 382 /* Check if there still is enough buffer left */
383 while (outbuf.pos + OT_SCRAPE_MAXENTRYLEN > outbuf.size) { 383 while (outbuf.pos + OT_SCRAPE_MAXENTRYLEN > outbuf.size) {
384 iovector.iov_len = outbuf.size; 384 iovector.iov_len = outbuf.pos;
385 385
386 if (workqueue_pushchunked(taskid, &iovector)) { 386 if (workqueue_pushchunked(taskid, &iovector)) {
387 free(iovector.iov_base); 387 free(iovector.iov_base);
@@ -419,6 +419,11 @@ static void fullscrape_make_zstd(int taskid, ot_tasktype mode) {
419 inbuf.src = (const void *)"ee"; 419 inbuf.src = (const void *)"ee";
420 inbuf.size = strlen("ee"); 420 inbuf.size = strlen("ee");
421 inbuf.pos = 0; 421 inbuf.pos = 0;
422 } else {
423 /* Nothing more to feed, and with no torrent written nothing was set */
424 inbuf.src = (const void *)"";
425 inbuf.size = 0;
426 inbuf.pos = 0;
422 } 427 }
423 428
424 more_bytes = ZSTD_compressStream2(zstream, &outbuf, &inbuf, ZSTD_e_end); 429 more_bytes = ZSTD_compressStream2(zstream, &outbuf, &inbuf, ZSTD_e_end);