summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--ot_http.c12
2 files changed, 13 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 59296bc..803a2e0 100644
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,10 @@ FEATURES+=-DWANT_COMPRESSION_GZIP_ALWAYS
38#FEATURES+=-DWANT_DEV_RANDOM 38#FEATURES+=-DWANT_DEV_RANDOM
39FEATURES+=-DWANT_FULLSCRAPE 39FEATURES+=-DWANT_FULLSCRAPE
40 40
41# You need libowfat version 0.34 to allow for automatic release of chunks during
42# full scrape transfer, if you rely on an older versions, enable this flag
43#FEATURES+=-DWANT_NO_AUTO_FREE
44
41# Is enabled on BSD systems by default in trackerlogic.h 45# Is enabled on BSD systems by default in trackerlogic.h
42# on Linux systems you will need -lbds 46# on Linux systems you will need -lbds
43#FEATURES+=-DWANT_ARC4RANDOM 47#FEATURES+=-DWANT_ARC4RANDOM
diff --git a/ot_http.c b/ot_http.c
index 2e2a085..ddb3e81 100644
--- a/ot_http.c
+++ b/ot_http.c
@@ -30,6 +30,12 @@
30#include "scan_urlencoded_query.h" 30#include "scan_urlencoded_query.h"
31#include "trackerlogic.h" 31#include "trackerlogic.h"
32 32
33#ifdef WANT_NO_AUTO_FREE
34#define OT_IOB_INIT iob_init
35#else
36#define OT_IOB_INIT iob_init_autofree
37#endif
38
33#define OT_MAXMULTISCRAPE_COUNT 64 39#define OT_MAXMULTISCRAPE_COUNT 64
34#define OT_BATCH_LIMIT (1024 * 1024 * 16) 40#define OT_BATCH_LIMIT (1024 * 1024 * 16)
35extern char *g_redirecturl; 41extern char *g_redirecturl;
@@ -81,7 +87,7 @@ static void http_senddata(const int64 sock, struct ot_workstruct *ws) {
81 memcpy(outbuf, ws->reply + written_size, ws->reply_size - written_size); 87 memcpy(outbuf, ws->reply + written_size, ws->reply_size - written_size);
82 if (!cookie->batch) { 88 if (!cookie->batch) {
83 cookie->batch = malloc(sizeof(io_batch)); 89 cookie->batch = malloc(sizeof(io_batch));
84 iob_init_autofree(cookie->batch, 0); 90 OT_IOB_INIT(cookie->batch, 0);
85 cookie->batches = 1; 91 cookie->batches = 1;
86 } 92 }
87 93
@@ -179,7 +185,7 @@ ssize_t http_sendiovecdata(const int64 sock, struct ot_workstruct *ws, int iovec
179 iovec_free(&iovec_entries, &iovector); 185 iovec_free(&iovec_entries, &iovector);
180 HTTPERROR_500; 186 HTTPERROR_500;
181 } 187 }
182 iob_init_autofree(cookie->batch, 0); 188 OT_IOB_INIT(cookie->batch, 0);
183 cookie->batches = 1; 189 cookie->batches = 1;
184 } 190 }
185 current = cookie->batch + cookie->batches - 1; 191 current = cookie->batch + cookie->batches - 1;
@@ -193,7 +199,7 @@ ssize_t http_sendiovecdata(const int64 sock, struct ot_workstruct *ws, int iovec
193 if (new_batch) { 199 if (new_batch) {
194 cookie->batch = new_batch; 200 cookie->batch = new_batch;
195 current = cookie->batch + cookie->batches++; 201 current = cookie->batch + cookie->batches++;
196 iob_init_autofree(current, 0); 202 OT_IOB_INIT(current, 0);
197 } 203 }
198 } 204 }
199 iob_addbuf_free(current, iovector[i].iov_base, iovector[i].iov_len); 205 iob_addbuf_free(current, iovector[i].iov_base, iovector[i].iov_len);