Skip to content
Snippets Groups Projects
Commit 6360476d authored by Jan Včelák's avatar Jan Včelák :rocket:
Browse files

packet: migrate to new knot_rrset_to_wire()

parent eb605fea
No related branches found
No related tags found
No related merge requests found
......@@ -488,9 +488,7 @@ int knot_pkt_put(knot_pkt_t *pkt, uint16_t compr_hint, const knot_rrset_t *rr,
}
uint8_t *pos = pkt->wire + pkt->size;
uint16_t rr_added = 0;
size_t maxlen = pkt_remaining(pkt);
size_t len = maxlen;
/* Create compression context. */
knot_compr_t compr;
......@@ -501,8 +499,8 @@ int knot_pkt_put(knot_pkt_t *pkt, uint16_t compr_hint, const knot_rrset_t *rr,
compr.wire);
/* Write RRSet to wireformat. */
int ret = knot_rrset_to_wire(rr, pos, &len, maxlen, &rr_added, &compr);
if (ret != KNOT_EOK) {
int ret = knot_rrset_to_wire(rr, pos, maxlen, &compr, 0);
if (ret < 0) {
dbg_packet("%s: rr_to_wire = %s\n,", __func__, knot_strerror(ret));
/* Truncate packet if required. */
......@@ -513,6 +511,9 @@ int knot_pkt_put(knot_pkt_t *pkt, uint16_t compr_hint, const knot_rrset_t *rr,
return ret;
}
size_t len = ret;
uint16_t rr_added = rr->rrs.rr_count;
/* Keep reference to special types. */
if (rr->type == KNOT_RRTYPE_OPT) {
pkt->opt_rr = &pkt->rr[pkt->rrset_count];
......
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