Skip to content
Snippets Groups Projects
Commit f2a995dc authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

Promote good matches in compr. table even if no new name is inserted.

Change-Id: Id5b03f108e2892488c55be1e90dec1bd6fde6467
parent 5694b39b
No related branches found
No related tags found
No related merge requests found
......@@ -140,6 +140,13 @@ int knot_response_compress_dname(const knot_dname_t *dname, knot_compr_t *compr,
written += 1;
}
/* Promote good matches. */
if (match_id > 1) {
match = compr->table[match_id];
compr->table[match_id] = compr->table[match_id - 1];
compr->table[match_id - 1] = match;
}
/* Do not insert if exceeds bounds or full match. */
if (match.lbcount == dname->label_count ||
compr->wire_pos > KNOT_WIRE_PTR_MAX)
......@@ -158,13 +165,6 @@ int knot_response_compress_dname(const knot_dname_t *dname, knot_compr_t *compr,
compr->table[i].lbcount = dname->label_count;
}
/* Promote good matches. */
if (match_id > 1) {
match = compr->table[match_id];
compr->table[match_id] = compr->table[match_id - 1];
compr->table[match_id - 1] = match;
}
return written;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment