summaryrefslogtreecommitdiff
path: root/ot_http.c
diff options
context:
space:
mode:
Diffstat (limited to 'ot_http.c')
-rw-r--r--ot_http.c12
1 files changed, 9 insertions, 3 deletions
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);