Skip to content

Commit

Permalink
fixup pkarr
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Sep 16, 2024
1 parent 43e368d commit 17b4788
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions iroh-pkarr-naming-system/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }

Expand Down
7 changes: 4 additions & 3 deletions iroh-pkarr-naming-system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ 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},
Name, Packet, ResourceRecord, CLASS,
},
SignedPacket,
};
use tokio_util::task::AbortOnDropHandle;

/// The key for the content of an IPNS record.
const CONTENT_KEY: &str = "_content.iroh.";
Expand Down Expand Up @@ -49,7 +50,7 @@ pub struct IPNS(Arc<Inner>);
#[derive(Debug, Default)]
struct Inner {
pkarr: Arc<pkarr::PkarrClient>,
packets: Mutex<BTreeMap<iroh_net::key::PublicKey, (Record, AbortingJoinHandle<()>)>>,
packets: Mutex<BTreeMap<iroh_net::key::PublicKey, (Record, AbortOnDropHandle<()>)>>,
}

impl IPNS {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 17b4788

Please sign in to comment.