fix: disable provide_block for now

Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
ljedrz 2020-08-05 14:08:16 +02:00
parent 7e799f0e90
commit e2f87bd32b
2 changed files with 16 additions and 8 deletions

View File

@ -433,13 +433,19 @@ impl<Types: IpfsTypes> Behaviour<Types> {
&mut self,
cid: Cid,
) -> Result<SubscriptionFuture<(), String>, anyhow::Error> {
let key = cid.to_bytes();
match self.kademlia.start_providing(key.into()) {
// Kademlia queries are marked with QueryIds, which are most fitting to
// be used as kad Subscription keys - they are small and require no
// conversion for the applicable finish_subscription calls
Ok(id) => Ok(self.kad_subscriptions.create_subscription(id.into(), None)),
Err(e) => Err(anyhow!("kad: can't provide block {}: {:?}", cid, e)),
// currently disabled; see https://github.com/rs-ipfs/rust-ipfs/pull/281#discussion_r465583345
// for details regarding the concerns about enabling this functionality as-is
if false {
let key = cid.to_bytes();
match self.kademlia.start_providing(key.into()) {
// Kademlia queries are marked with QueryIds, which are most fitting to
// be used as kad Subscription keys - they are small and require no
// conversion for the applicable finish_subscription calls
Ok(id) => Ok(self.kad_subscriptions.create_subscription(id.into(), None)),
Err(e) => Err(anyhow!("kad: can't provide block {}: {:?}", cid, e)),
}
} else {
Err(anyhow!("providing blocks is currently unsupported"))
}
}

View File

@ -216,7 +216,9 @@ impl<TRepoTypes: RepoTypes> Repo<TRepoTypes> {
.await
.ok();
rx.await??.await?;
if let Ok(kad_subscription) = rx.await? {
kad_subscription.await?;
}
}
Ok((cid, res))