Skip to content

Commit

Permalink
Merge branch 'main' into matheus23/more-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus23 authored Sep 2, 2024
2 parents 228a753 + 2347565 commit 81dcf53
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion iroh-blobs/src/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ impl Downloader {
}
}

/// Declare that certains nodes can be used to download a hash.
/// Declare that certain nodes can be used to download a hash.
///
/// Note that this does not start a download, but only provides new nodes to already queued
/// downloads. Use [`Self::queue`] to queue a download.
Expand Down
6 changes: 3 additions & 3 deletions iroh-blobs/src/store/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ impl Actor {
let mut delete_after_commit = Default::default();
let mut tables = Tables::new(&txn, &mut delete_after_commit)?;
let count = self.state.options.batch.max_write_batch;
let timeout = tokio::time::sleep(self.state.options.batch.max_read_duration);
let timeout = tokio::time::sleep(self.state.options.batch.max_write_duration);
tokio::pin!(timeout);
for _ in 0..count {
tokio::select! {
Expand Down Expand Up @@ -1814,11 +1814,11 @@ impl ActorState {
data.size(),
&hash,
)?;
println!("creating complete entry for {}", hash.to_hex());
tracing::debug!("creating complete entry for {}", hash.to_hex());
BaoFileHandle::new_complete(self.create_options.clone(), hash, data, outboard)
}
EntryState::Partial { .. } => {
println!("creating partial entry for {}", hash.to_hex());
tracing::debug!("creating partial entry for {}", hash.to_hex());
BaoFileHandle::incomplete_file(self.create_options.clone(), hash)?
}
}
Expand Down
21 changes: 15 additions & 6 deletions iroh-net/src/discovery/local_swarm_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,28 @@ impl LocalSwarmDiscovery {
continue;
}

if let Some(senders) = senders.get(&discovered_node_id) {
for sender in senders.values() {
let item: DiscoveryItem = (&peer_info).into();
trace!(?item, "sending DiscoveryItem");
sender.send(Ok(item)).await.ok();
let entry = node_addrs.entry(discovered_node_id);
if let std::collections::hash_map::Entry::Occupied(ref entry) = entry {
if entry.get() == &peer_info {
// this is a republish we already know about
continue;
}
}

debug!(
?discovered_node_id,
?peer_info,
"adding node to LocalSwarmDiscovery address book"
);
node_addrs.insert(discovered_node_id, peer_info);

if let Some(senders) = senders.get(&discovered_node_id) {
let item: DiscoveryItem = (&peer_info).into();
trace!(?item, senders = senders.len(), "sending DiscoveryItem");
for sender in senders.values() {
sender.send(Ok(item.clone())).await.ok();
}
}
entry.or_insert(peer_info);
}
Message::SendAddrs(node_id, sender) => {
let id = last_id + 1;
Expand Down

0 comments on commit 81dcf53

Please sign in to comment.