daemon/engine: move defines from header to respective *.c

Also don't allocate much memory for cookies if we compile them out.
parent 71947f19
......@@ -33,6 +33,21 @@
#include "lib/cache/cdb_lmdb.h"
#include "lib/dnssec/ta.h"
/* Magic defaults for the engine. */
#ifndef LRU_RTT_SIZE
#define LRU_RTT_SIZE 65536 /**< NS RTT cache size */
#endif
#ifndef LRU_REP_SIZE
#define LRU_REP_SIZE (LRU_RTT_SIZE / 4) /**< NS reputation cache size */
#endif
#ifndef LRU_COOKIES_SIZE
#ifdef ENABLE_COOKIES
#define LRU_COOKIES_SIZE LRU_RTT_SIZE /**< DNS cookies cache size. */
#else
#define LRU_COOKIES_SIZE LRU_ASSOC /* simpler than guards everywhere */
#endif
#endif
/** @internal Compatibility wrapper for Lua < 5.2 */
#if LUA_VERSION_NUM < 502
#define lua_rawlen(L, obj) lua_objlen((L), (obj))
......@@ -608,6 +623,7 @@ static int l_trampoline(lua_State *L)
static int init_resolver(struct engine *engine)
{
/* Note: it had been zored by engine_init(). */
/* Open resolution context */
engine->resolver.trust_anchors = map_make(NULL);
engine->resolver.negative_anchors = map_make(NULL);
......
......@@ -16,33 +16,6 @@
#pragma once
/* Magic defaults */
#ifndef LRU_RTT_SIZE
#define LRU_RTT_SIZE 65536 /**< NS RTT cache size */
#endif
#ifndef LRU_REP_SIZE
#define LRU_REP_SIZE (LRU_RTT_SIZE / 4) /**< NS reputation cache size */
#endif
#ifndef LRU_COOKIES_SIZE
#define LRU_COOKIES_SIZE LRU_RTT_SIZE /**< DNS cookies cache size. */
#endif
#ifndef MP_FREELIST_SIZE
# ifdef __clang_analyzer__
# define MP_FREELIST_SIZE 0
# else
# define MP_FREELIST_SIZE 64 /**< Maximum length of the worker mempool freelist */
# endif
#endif
#ifndef RECVMMSG_BATCH
#define RECVMMSG_BATCH 1
#endif
#ifndef QUERY_RATE_THRESHOLD
#define QUERY_RATE_THRESHOLD (2 * MP_FREELIST_SIZE) /**< Nr of parallel queries considered as high rate */
#endif
#ifndef MAX_PIPELINED
#define MAX_PIPELINED 100
#endif
/*
* @internal These are forward decls to allow building modules with engine but without Lua.
*/
......
......@@ -38,6 +38,22 @@
#include "daemon/zimport.h"
#include "daemon/session.h"
/* Magic defaults for the worker. */
#ifndef MP_FREELIST_SIZE
# ifdef __clang_analyzer__
# define MP_FREELIST_SIZE 0
# else
# define MP_FREELIST_SIZE 64 /**< Maximum length of the worker mempool freelist */
# endif
#endif
#ifndef QUERY_RATE_THRESHOLD
#define QUERY_RATE_THRESHOLD (2 * MP_FREELIST_SIZE) /**< Nr of parallel queries considered as high rate */
#endif
#ifndef MAX_PIPELINED
#define MAX_PIPELINED 100
#endif
#define VERBOSE_MSG(qry, fmt...) QRVERBOSE(qry, "wrkr", fmt)
/** Client request state. */
......
......@@ -108,6 +108,10 @@ void worker_request_set_source_session(struct request_ctx *, struct session *ses
/** Maximum response time from TCP upstream, milliseconds */
#define MAX_TCP_INACTIVITY (KR_RESOLVE_TIME_LIMIT + KR_CONN_RTT_MAX)
#ifndef RECVMMSG_BATCH /* see check_bufsize() */
#define RECVMMSG_BATCH 1
#endif
/** Freelist of available mempools. */
typedef array_t(struct mempool *) mp_freelist_t;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment