diff --git a/daemon/worker.c b/daemon/worker.c index 3ad26924772511339d569fa635cb5f16c8234426..850d02f560b7239e1c8a20090d092e7e46aa070d 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -1307,8 +1307,7 @@ static void on_tcp_connect_timeout(uv_timer_t *timer) while (session->waiting.len > 0) { struct qr_task *task = session->waiting.at[0]; - struct request_ctx *ctx = task->ctx; - assert(ctx); + assert(task->ctx); task->timeouts += 1; worker->stats.timeout += 1; session_del_tasks(session, task); @@ -1367,9 +1366,7 @@ static void on_tcp_watchdog_timeout(uv_timer_t *timer) static void on_udp_timeout(uv_timer_t *timer) { struct session *session = timer->data; - - uv_handle_t *handle = session->handle; - assert(handle->data == session); + assert(session->handle->data == session); uv_timer_stop(timer); assert(session->tasks.len == 1); @@ -1479,7 +1476,7 @@ static void subreq_finalize(struct qr_task *task, const struct sockaddr *packet_ if (klen > 0) { void *val_deleted; int ret = trie_del(task->ctx->worker->subreq_out, key, klen, &val_deleted); - assert(ret == KNOT_EOK && val_deleted == task); + assert(ret == KNOT_EOK && val_deleted == task); (void)ret; } /* Notify waiting tasks. */ struct kr_query *leader_qry = array_tail(task->ctx->req.rplan.pending); @@ -1993,21 +1990,20 @@ static int worker_add_tcp_connected(struct worker_ctx *worker, const struct sockaddr* addr, struct session *session) { +#ifndef NDEBUG assert(addr); const char *key = tcpsess_key(addr); assert(key); assert(map_contains(&worker->tcp_connected, key) == 0); +#endif return map_add_tcp_session(&worker->tcp_connected, addr, session); } static int worker_del_tcp_connected(struct worker_ctx *worker, const struct sockaddr* addr) { - assert(addr); - const char *key = tcpsess_key(addr); - assert(key); - int ret = map_del_tcp_session(&worker->tcp_connected, addr); - return ret; + assert(addr && tcpsess_key(addr)); + return map_del_tcp_session(&worker->tcp_connected, addr); } static struct session* worker_find_tcp_connected(struct worker_ctx *worker, @@ -2020,22 +2016,20 @@ static int worker_add_tcp_waiting(struct worker_ctx *worker, const struct sockaddr* addr, struct session *session) { +#ifndef NDEBUG assert(addr); const char *key = tcpsess_key(addr); assert(key); assert(map_contains(&worker->tcp_waiting, key) == 0); - int ret = map_add_tcp_session(&worker->tcp_waiting, addr, session); - return ret; +#endif + return map_add_tcp_session(&worker->tcp_waiting, addr, session); } static int worker_del_tcp_waiting(struct worker_ctx *worker, const struct sockaddr* addr) { - assert(addr); - const char *key = tcpsess_key(addr); - assert(key); - int ret = map_del_tcp_session(&worker->tcp_waiting, addr); - return ret; + assert(addr && tcpsess_key(addr)); + return map_del_tcp_session(&worker->tcp_waiting, addr); } static struct session* worker_find_tcp_waiting(struct worker_ctx *worker, diff --git a/lib/cache/nsec3.c b/lib/cache/nsec3.c index 076cfb03bd1c899e770b8d837e1d704360b29982..58f7f562d5c18fe2b5e6b7b4230cf395c6b5d0b5 100644 --- a/lib/cache/nsec3.c +++ b/lib/cache/nsec3.c @@ -245,7 +245,7 @@ static void key_NSEC3_hash2text(const knot_db_val_t key, char *text) /* CACHE_KEY_DEF ^^ */ int len = base32hex_encode(hash_raw, NSEC3_HASH_LEN, (uint8_t *)text, NSEC3_HASH_TXT_LEN); - assert(len == NSEC3_HASH_TXT_LEN); + assert(len == NSEC3_HASH_TXT_LEN); (void)len; text[NSEC3_HASH_TXT_LEN] = '\0'; } diff --git a/lib/layer/iterate.c b/lib/layer/iterate.c index a02acfba7a429d817a3d98671c46d3b1c9b8d01c..84b728139fbbe7a672041ae46683a5f73076a1ff 100644 --- a/lib/layer/iterate.c +++ b/lib/layer/iterate.c @@ -573,7 +573,8 @@ static int unroll_cname(knot_pkt_t *pkt, struct kr_request *req, bool referral, } /* The validator still can't handle multiple zones in one answer, * so we only follow if a single label is replaced. - * TODO: this still isn't 100%, as the target may have a NS+DS. */ + * TODO: this still isn't 100%, as the target might have a NS+DS, + * possibly leading to a SERVFAIL for the in-bailiwick name. */ const int pending_labels = knot_dname_labels(pending_cname, NULL); if (pending_labels != cname_labels) { cname = pending_cname;