Marek Vavruša [Mon, 2 Apr 2018 23:42:42 +0000 (16:42 -0700)]
modules/http: added an error handler to HTTP streams
Instead of throwing an error in the HTTP handler, server should log it.
This covers errors like client disconnecting before reading the response
body etc.
Vladimír Čunát [Wed, 17 Oct 2018 17:00:53 +0000 (19:00 +0200)]
lib/zonecut: avoid one kind of NS dependency cycles
The problem here was that we need to know which addresses are timed-out
(and not to be re-probed) much earlier than we do NS selection ATM -
that's because under some circumstances it affects the depth of NS
zone cut that we choose, i.e. if all addresses in a certain zone cut are
"bad" in a certain sense, we need to use a zone cut closer to the root,
because otherwise we'd get into a dependency cycle.
Vladimír Čunát [Fri, 2 Nov 2018 11:30:32 +0000 (12:30 +0100)]
lib/generic/queue: remove a ssize_t cast
The Alpine-based Docker image wouldn't compile.
I can't see a reason for the cast now - it's a sum of compile-time
constants, and very unlikely to overflow on changes in code or platform.
Vladimír Čunát [Tue, 11 Sep 2018 14:07:22 +0000 (16:07 +0200)]
kres.str2dname: perform lower-casing
We use it as relatively high-level function, often on user-input names,
so it seems suitable that it does convert the case.
This fixes cache.clear('Example.Org.'), and probably also negative trust
anchors and policy uses.
Vladimír Čunát [Fri, 12 Oct 2018 12:18:43 +0000 (14:18 +0200)]
docs for daemon: better visibility for control sockets
- promote the part into a section
- move it right after the section about interactive CLI
- minor reformulations, location of the sockets, etc.
- fix location of the daemon-supervised anchor
Grigorii Demidov [Mon, 22 Oct 2018 08:48:51 +0000 (10:48 +0200)]
daemon: TCP connection timeouting has changed; connection was closed after peer's inactivity before, now it is closed after incativity in both directions (peer->kresd, kresd->peer); prevents connection from closing before answer sent to client
Vladimír Čunát [Wed, 10 Oct 2018 15:00:07 +0000 (17:00 +0200)]
cache: avoid some crashes
It's actually possible to start queries without any cache open,
e.g. add `resolve('.', kres.type.DNSKEY)` into your configuration.
If that happens, avoid the cache module dereferencing a NULL pointer.
Vladimír Čunát [Wed, 19 Sep 2018 14:57:24 +0000 (16:57 +0200)]
trie_it nitpick: reduce the initial stack size
Using 2kB as start is a bit too much, and it was showing as 0.5% CPU
on malloc() called during trie_it_begin(). Let's start at 0.5 kB,
as it can grow anyway (only negligible in profile now).
Vladimír Čunát [Mon, 15 Oct 2018 13:08:38 +0000 (13:08 +0000)]
Merge !675: daemon: first part of refactoring
- mainly the daemon/session.* files are separated,
moving lots of logic from daemon/worker.*;
- lib/generic/queue.* are added;
- verbose logging gets different IDs;
- various minor changes around.
Vladimír Čunát [Thu, 4 Oct 2018 12:43:54 +0000 (14:43 +0200)]
daemon/session nitpick: avoid a warning
lint:clang-scan-build reported:
> warning: The code calls sizeof() on a pointer type.
> This can produce an unexpected result
but in our case it's intentional.
(Yes, using pointers as keys in trie isn't very pretty.)
Vladimír Čunát [Wed, 19 Sep 2018 18:50:29 +0000 (20:50 +0200)]
daemon nitpick cleanups
- Some (potentially) unused vars were left behind.
- The two on_* functions are identical except for the uv types passed,
and those are surely the same in the part we use, but it's not worth
to deduplicate when these functions are only two and so simple.
- lint:c was complaining about the uv_tcp_t malloc().
Vladimír Čunát [Wed, 19 Sep 2018 18:05:08 +0000 (20:05 +0200)]
daemon: drop RECVMMSG_BATCH
The support hasn't landed in libuv over all the years,
and we've been still reserving memory for it in advance.
Also comment on the singleton buffer usage.
Vladimír Čunát [Wed, 19 Sep 2018 17:39:26 +0000 (19:39 +0200)]
worker: safer code around the mempool freelist
I did NOT remove this one, as in a quick profile that would be
increase in roughly 0.5% time in malloc, so that's possibly justifiable.
(And this one is much less obstructing to splitting the worker code.)
Vladimír Čunát [Wed, 19 Sep 2018 16:39:17 +0000 (18:39 +0200)]
worker: remove freelists for iohandle and iorequest
A quick profiling showed no change in performance,
and in particular no change in time spent in malloc/free.
Some of the types in the union differed in size by a multiple.
If their performance won't be satisfying, replacements should be
considered first (e.g. jemalloc) before rolling our own stuff.
daemon: logic around struct session was relocated to separate module; input data buffering scheme was changed (libuv); attempt was made to simplify processing of the stream