From 17b4788fa5863969a5e6bca1cf7a132c635bb65f Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Mon, 16 Sep 2024 18:37:16 +0200 Subject: [PATCH] fixup pkarr --- iroh-pkarr-naming-system/Cargo.toml | 1 + iroh-pkarr-naming-system/src/lib.rs | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/iroh-pkarr-naming-system/Cargo.toml b/iroh-pkarr-naming-system/Cargo.toml index 9fb884e..85af807 100644 --- a/iroh-pkarr-naming-system/Cargo.toml +++ b/iroh-pkarr-naming-system/Cargo.toml @@ -13,6 +13,7 @@ iroh-blobs = "0.24" iroh-net = "0.24" pkarr = { version = "1.0.1", features = ["async", "dht"] } tokio = "1.35.1" +tokio-util = "0.7.12" tracing = "0.1.40" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/iroh-pkarr-naming-system/src/lib.rs b/iroh-pkarr-naming-system/src/lib.rs index 70a3c81..1819932 100644 --- a/iroh-pkarr-naming-system/src/lib.rs +++ b/iroh-pkarr-naming-system/src/lib.rs @@ -7,7 +7,7 @@ use std::{ use anyhow::Context; use iroh_blobs::HashAndFormat; -use iroh_net::{key::SecretKey, util::AbortingJoinHandle}; +use iroh_net::key::SecretKey; use pkarr::{ dns::{ rdata::{RData, TXT}, @@ -15,6 +15,7 @@ use pkarr::{ }, SignedPacket, }; +use tokio_util::task::AbortOnDropHandle; /// The key for the content of an IPNS record. const CONTENT_KEY: &str = "_content.iroh."; @@ -49,7 +50,7 @@ pub struct IPNS(Arc); #[derive(Debug, Default)] struct Inner { pkarr: Arc, - packets: Mutex)>>, + packets: Mutex)>>, } impl IPNS { @@ -79,7 +80,7 @@ impl IPNS { } }); let mut packets = self.0.packets.lock().unwrap(); - packets.insert(key, (record, AbortingJoinHandle::from(publish_task))); + packets.insert(key, (record, AbortOnDropHandle::new(publish_task))); } else { let mut packets = self.0.packets.lock().unwrap(); packets.remove(&key);