Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Commit

Permalink
network/retrieval: fix race condition where a retrieve request has be…
Browse files Browse the repository at this point in the history
…en (#1902)

answered before peer.addRetrieval was called

Co-Authored-By: Ralph Pichler <pichler.ralph@gmail.com>
  • Loading branch information
acud and ralph-pichler committed Oct 23, 2019
1 parent 1a64457 commit e9042ba
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions network/retrieval/retrieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,13 @@ FINDPEER:
Addr: req.Addr,
}
protoPeer.logger.Trace("sending retrieve request", "ref", ret.Addr, "origin", localID, "ruid", ret.Ruid)
protoPeer.addRetrieval(ret.Ruid, ret.Addr)
err = protoPeer.Send(ctx, ret)
if err != nil {
protoPeer.logger.Error("error sending retrieve request to peer", "ruid", ret.Ruid, "err", err)
return nil, err
}

protoPeer.addRetrieval(ret.Ruid, ret.Addr)

spID := protoPeer.ID()
return &spID, nil
}
Expand Down

0 comments on commit e9042ba

Please sign in to comment.