nitpicks from review of !405: query-trace

The deckard change was probably unintentional, so I reverted that.
The only real mistake I found was `sizeof(128)`, though the effect was
just unnecessary reallocations.

On the whole I really like it.  Verbose logging might get slightly
slower, due to increased amount of string allocation and copying,
but it does seem worth it, at least until we can prove otherwise.
I didn't look much into http module changes, etc.
parent 1f0a0f6c
......@@ -277,10 +277,10 @@ to download cache from parent, to avoid cold-cache start.
cache.size = 100*MB
end
Events and services
Asynchronous events
^^^^^^^^^^^^^^^^^^^
The Lua supports a concept called closures_, this is extremely useful for scripting actions upon various events,
Lua supports a concept called closures_, this is extremely useful for scripting actions upon various events,
say for example - prune the cache within minute after loading, publish statistics each 5 minutes and so on.
Here's an example of an anonymous function with :func:`event.recurrent()`:
......@@ -319,9 +319,8 @@ event loops or monitor open files and then fire a callback when an activity is d
This allows you to build persistent services like HTTP servers or monitoring probes that cooperate
well with the daemon internal operations. See :func:`event.socket()`
* File watchers
This is possible with :func:`worker.coroutine()` and cqueues_, see the cqueues documentation for more information.
File watchers are possible with :func:`worker.coroutine()` and cqueues_, see the cqueues documentation for more information.
.. code-block:: lua
......@@ -440,7 +439,7 @@ Environment
> user('root')
Operation not permitted
.. function:: resolve(name, type[, class = kres.class.IN, options = 0, finish = nil])
.. function:: resolve(name, type[, class = kres.class.IN, options = {}, finish = nil])
:param string name: Query name (e.g. 'com.')
:param number type: Query type (e.g. ``kres.type.NS``)
......
......@@ -2190,6 +2190,7 @@ int worker_process_tcp(struct worker_ctx *worker, uv_stream_t *handle,
struct qr_task *worker_resolve_start(struct worker_ctx *worker, knot_pkt_t *query, struct kr_qflags options)
{
if (!worker || !query) {
assert(!EINVAL);
return NULL;
}
......
......@@ -834,7 +834,9 @@ char *kr_pkt_text(const knot_pkt_t *pkt)
struct mempool *mp = mp_new(512);
static char *snames[] = {";; ANSWER SECTION",";; AUTHORITY SECTION",";; ADDITIONAL SECTION"};
static const char * snames[] = {
";; ANSWER SECTION", ";; AUTHORITY SECTION", ";; ADDITIONAL SECTION"
};
char rrtype[32];
char flags[32];
char qname[KNOT_DNAME_MAXLEN];
......@@ -881,6 +883,7 @@ char *kr_pkt_text(const knot_pkt_t *pkt)
for (knot_section_t i = KNOT_ANSWER; i <= KNOT_ADDITIONAL; ++i) {
const knot_pktsection_t *sec = knot_pkt_section(pkt, i);
if (sec->count == 0 || knot_pkt_rr(sec, 0)->type == KNOT_RRTYPE_OPT) {
/* OPT RRs are _supposed_ to be the last ^^, if they appear */
continue;
}
......@@ -908,8 +911,8 @@ char *kr_rrset_text(const knot_rrset_t *rr)
}
/* Note: knot_rrset_txt_dump will double the size until the rrset fits */
char *buf = malloc(128);
size_t bufsize = sizeof(128);
size_t bufsize = 128;
char *buf = malloc(bufsize);
int ret = knot_rrset_txt_dump(rr, &buf, &bufsize, &KNOT_DUMP_STYLE_DEFAULT);
if (ret < 0) {
free(buf);
......@@ -922,4 +925,4 @@ char *kr_rrset_text(const knot_rrset_t *rr)
uint64_t kr_now()
{
return uv_now(uv_default_loop());
}
\ No newline at end of file
}
Subproject commit 387e8845a45a7bab6ab1c8e5be55a8d88d0315ae
Subproject commit 0a844578608bb0c944880082bcbfce96453dfa98
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