From 6b0ae1fcc1b8f362c9487429f7637bcf0e81c8fa Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Wed, 25 Jan 2023 11:22:43 +1100 Subject: [PATCH] fix: send dont_have when retrieval immediately fails --- bitswap/provider.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bitswap/provider.go b/bitswap/provider.go index ae6dfd9..ca431f2 100644 --- a/bitswap/provider.go +++ b/bitswap/provider.go @@ -353,12 +353,17 @@ func (provider *Provider) handleRetrievals() { if errors.Is(err, lassieretriever.ErrNoCandidates) { // Just do a debug print if there were no candidates because this happens a lot log.Debugf("No candidates for %s", cid) + provider.queueSendDontHave(peerID, task.Priority, cid, "not_available") + continue } else { // Otherwise, there was a real failure, print with more importance log.Errorf("Request for %s failed: %v", cid, err) + provider.queueSendDontHave(peerID, task.Priority, cid, "not_available") + continue } } else { log.Debugf("Retrieval already running for %s, no new one will be started", cid) + // let AwaitBlock do its job to get this block } } else { log.Infof("Started retrieval for %s", cid)