From: Michael Tremer Date: Mon, 18 May 2026 16:58:09 +0000 (+0000) Subject: main: Store the XFR object with the zone context and clean it up X-Git-Tag: 0.0.1~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19582169c43ea64d1abad3a039454fec970b7228;p=zone-sync.git main: Store the XFR object with the zone context and clean it up Signed-off-by: Michael Tremer --- diff --git a/main.c b/main.c index 7bf1613..32cd52f 100644 --- a/main.c +++ b/main.c @@ -246,7 +246,11 @@ static void zone_done(dns_zone_t* z) { // Fetch the zone zone_ctx* zone = find_zone(z); if (!zone) - return ; + return; + + // Detach the XFR object + if (zone->xfrin) + dns_xfrin_detach(&zone->xfrin); // Release the zone from the manager dns_zonemgr_releasezone(ctx.zonemgr, zone->zone); @@ -298,8 +302,8 @@ static void transfer_done(dns_zone_t* zone, uint32_t* expireopt, isc_result_t re zone_done(zone); } -static int do_transfer(dns_zone_t* zone, uint32_t serial) { - dns_xfrin_t* xfrin = NULL; + +static int do_transfer(zone_ctx* zone, uint32_t serial) { dns_rdatatype_t xfrtype; int r; @@ -315,13 +319,13 @@ static int do_transfer(dns_zone_t* zone, uint32_t serial) { } // Require at least 10 kBit/s to be transmitted over 5 minutes - dns_zone_setminxfrratein(zone, 10240, 300); + dns_zone_setminxfrratein(zone->zone, 10240, 300); - dns_xfrin_create(zone, xfrtype, &ctx.primary_address, &ctx.source_address, NULL, - DNS_TRANSPORT_NONE, ctx.transport, ctx.tlsctx_cache, ctx.memctx, &xfrin); + dns_xfrin_create(zone->zone, xfrtype, &ctx.primary_address, &ctx.source_address, NULL, + DNS_TRANSPORT_NONE, ctx.transport, ctx.tlsctx_cache, ctx.memctx, &zone->xfrin); // Start the transfer - r = dns_xfrin_start(xfrin, transfer_done); + r = dns_xfrin_start(zone->xfrin, transfer_done); switch (r) { case ISC_R_SUCCESS: break; @@ -335,7 +339,7 @@ static int do_transfer(dns_zone_t* zone, uint32_t serial) { return r; ERROR: - zone_done(zone); + zone_done(zone->zone); return r; } @@ -364,7 +368,7 @@ static isc_result_t zone_loaded(void* data) { } // Initiate the transfer - return do_transfer(zone->zone, serial); + return do_transfer(zone, serial); ERROR: // Destroy the zone