From c30bf68e11f04afb8da6a5b8ebc661401ffcb740 Mon Sep 17 00:00:00 2001 From: Ximon Eighteen <3304436+ximon18@users.noreply.github.com> Date: Thu, 26 Sep 2024 16:23:53 +0200 Subject: [PATCH] Added some comments. --- examples/serve-zone.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/serve-zone.rs b/examples/serve-zone.rs index 7543d8310..57481dc3d 100644 --- a/examples/serve-zone.rs +++ b/examples/serve-zone.rs @@ -109,11 +109,14 @@ async fn main() { zones.insert_zone(zone).unwrap(); let zones = Arc::new(zones); + // Create an XFR data provider that can serve diffs for our zone. + let zones_and_diffs = ZoneTreeWithDiffs::new(zones.clone()); + + // Create a server with middleware layers and an application service + // listening on localhost port 8053. let addr = "127.0.0.1:8053"; let svc = service_fn(my_service, zones.clone()); - let zones_and_diffs = ZoneTreeWithDiffs::new(zones.clone()); - #[cfg(feature = "siphasher")] let svc = CookiesMiddlewareSvc::, _, _>::with_random_secret(svc); let svc = EdnsMiddlewareSvc::, _, _>::new(svc); @@ -155,6 +158,7 @@ async fn main() { eprintln!(); eprintln!("Tip: set env var RUST_LOG=info (or debug or trace) for more log output."); + // Print some status information every 5 seconds tokio::spawn(async move { loop { tokio::time::sleep(Duration::from_millis(5000)).await; @@ -188,6 +192,7 @@ async fn main() { } }); + // Mutate our own zone every 10 seconds. tokio::spawn(async move { let zone_name = Name::>::from_str("example.com").unwrap(); let mut label: Option = None;