]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Apply suggestions from code review
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 5 Nov 2024 12:38:06 +0000 (13:38 +0100)
committerGitHub <noreply@github.com>
Tue, 5 Nov 2024 12:38:06 +0000 (13:38 +0100)
Co-authored-by: Remi Gacogne <github@coredump.fr>
pdns/recursordist/rec-xfr.cc
pdns/recursordist/rec-xfr.hh
pdns/recursordist/settings/docs-new-preamble-in.rst

index 3fa26e0c890a27c30eefcfc8e67918ed7758e50f..fc26abf1fb9c752d98c738127f00e1c4fc3c2ec0 100644 (file)
@@ -75,7 +75,7 @@ void CatalogZone::remove(const DNSRecord& record, Logr::log_t logger)
   d_records.erase(std::make_pair(key, record.d_type));
 }
 
-void CatalogZone::registerForwarders(const FWCatz& params, Logr::log_t logger)
+void CatalogZone::registerForwarders(const FWCatz& params, Logr::log_t logger) const
 {
   const string zonesFile = ::arg()["api-config-dir"] + "/catzone." + d_name.toString();
   ::rust::Vec<::pdns::rust::settings::rec::ForwardZone> forwards;
@@ -231,7 +231,7 @@ static shared_ptr<const SOARecordContent> loadZoneFromServer(Logr::log_t plogger
   return soaRecordContent;
 }
 
-void FWCatZoneXFR::preloadZoneFile(const DNSName& zoneName, std::shared_ptr<CatalogZone>& oldZone, uint32_t& refresh, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger)
+void FWCatZoneXFR::preloadZoneFile(const DNSName& zoneName, const std::shared_ptr<const CatalogZone>& oldZone, uint32_t& refresh, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger)
 {
   while (!d_params.soaRecordContent) {
     /* if we received an empty sr, the zone was not really preloaded */
@@ -283,7 +283,7 @@ void FWCatZoneXFR::preloadZoneFile(const DNSName& zoneName, std::shared_ptr<Cata
   }
 }
 
-bool FWCatZoneXFR::zoneTrackerIteration(const DNSName& zoneName, std::shared_ptr<CatalogZone>& oldZone, uint32_t& refresh, bool& skipRefreshDelay, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger)
+bool FWCatZoneXFR::zoneTrackerIteration(const DNSName& zoneName, std::shared_ptr<const CatalogZone>& oldZone, uint32_t& refresh, bool& skipRefreshDelay, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger)
 {
   // Don't hold on to oldZone, it well be re-assigned after sleep in the try block
   oldZone = nullptr;
@@ -466,7 +466,7 @@ void FWCatZoneXFR::zoneXFRTracker(ZoneXFRParams params, uint64_t configGeneratio
   ZoneWaiter waiter(std::this_thread::get_id());
 
   /* we can _never_ modify this zone directly, we need to do a full copy then replace the existing zone */
-  std::shared_ptr<CatalogZone> oldZone;
+  std::shared_ptr<const CatalogZone> oldZone;
   if (params.zoneIdx < g_luaconfs.getLocal()->catalogzones.size()) {
     oldZone = g_luaconfs.getLocal()->catalogzones.at(params.zoneIdx).d_catz;
   }
index cd5f8db67b8c48da84545da0806bfbb6e0c4ac7c..b6910610d2723b63caff063ca8af5597a5bcf587 100644 (file)
@@ -82,7 +82,7 @@ public:
   }
   void add(const DNSRecord& record, Logr::log_t logger);
   void remove(const DNSRecord& record, Logr::log_t logger);
-  void registerForwarders(const FWCatz& params, Logr::log_t logger);
+  void registerForwarders(const FWCatz& params, Logr::log_t logger) const;
   [[nodiscard]] bool versionCheck() const;
   [[nodiscard]] bool dupsCheck() const;
 
@@ -140,8 +140,8 @@ public:
   static void zoneXFRTracker(ZoneXFRParams params, uint64_t configGeneration);
 
 private:
-  void preloadZoneFile(const DNSName& zoneName, std::shared_ptr<CatalogZone>& oldZone, uint32_t& refresh, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger);
-  bool zoneTrackerIteration(const DNSName& zoneName, std::shared_ptr<CatalogZone>& oldZone, uint32_t& refresh, bool& skipRefreshDelay, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger);
+  void preloadZoneFile(const DNSName& zoneName, const std::shared_ptr<const CatalogZone>& oldZone, uint32_t& refresh, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger);
+  bool zoneTrackerIteration(const DNSName& zoneName, std::shared_ptr<const CatalogZone>& oldZone, uint32_t& refresh, bool& skipRefreshDelay, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger);
 };
 
 std::string reloadZoneConfiguration(bool yaml);
index 91acec8993e4e60932eb3c121512c34f71fccc83..186150186381f8af8c016816f9690827046d3d19 100644 (file)
@@ -488,7 +488,7 @@ As of version 5.2.0, a forwarding catalog zone entry is defined as:
          algo: string
          secret: base64string
        refresh: number, default not set
-       maxReceivedMBytes: number default not set
+       maxReceivedMBytes: number, default not set
        localAddress: IP address, default not set
        axfrTimeout: number, default 20
      groups:
@@ -497,7 +497,7 @@ As of version 5.2.0, a forwarding catalog zone entry is defined as:
        recurse: bool, default false
        notify: bool, default false
 
-An example of an ``forwarding_catalog_zones`` entry, which is a sequence of `ForwardingCatalogZone`_:
+An example of a ``forwarding_catalog_zones`` entry, which is a sequence of `ForwardingCatalogZone`_:
 
 .. code-block:: yaml
 
@@ -518,8 +518,8 @@ An example of an ``forwarding_catalog_zones`` entry, which is a sequence of `For
       - forwarders: [192.168.178.3] # only default forwarder for 2nd catalog zone
 
 :program:`Recursor` will transfer the catalog zone from the authoritative server using IXFR (falling back to AXFR if needed) and add forwarding clauses for all members of the catalog zone.
-The forwarding paremeters will be taken from the default group entry (the one without a name) defined in the YAML settings.
-For catalog zone members in a group, the forwarding parameters will be taken from the group entry with the correspoding name.
+The forwarding parameters will be taken from the default group entry (the one without a name) defined in the YAML settings.
+For catalog zone members in a group, the forwarding parameters will be taken from the group entry with the corresponding name.
 
 The forwarding definitions will be written into a file ``$api_dir/catzone.$zonename``. :ref:`setting-yaml-webservice.api_dir` must be defined, the directory must exist and be writable by the :program:`Recursor` process.