Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not create syncer if already at stopnode #173

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions dagsync/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -846,16 +846,6 @@ func (h *handler) asyncSyncAdChain(ctx context.Context) {

// Get the latest pending message.
amsg := h.pendingMsg.Swap(nil)
peerInfo := peer.AddrInfo{
ID: amsg.PeerID,
Addrs: amsg.Addrs,
}

syncer, updatePeerstore, err := h.makeSyncer(peerInfo, true)
if err != nil {
log.Errorw("Cannot make syncer for announce", "err", err, "peer", h.peerID)
return
}

adsDepthLimit := h.subscriber.adsDepthLimit
nextCid := amsg.Cid
Expand All @@ -872,6 +862,16 @@ func (h *handler) asyncSyncAdChain(ctx context.Context) {
adsDepthLimit = recursionLimit(h.subscriber.firstSyncDepth)
}

peerInfo := peer.AddrInfo{
ID: amsg.PeerID,
Addrs: amsg.Addrs,
}
syncer, updatePeerstore, err := h.makeSyncer(peerInfo, true)
if err != nil {
log.Errorw("Cannot make syncer for announce", "err", err, "peer", h.peerID)
return
}

sel := ExploreRecursiveWithStopNode(adsDepthLimit, h.subscriber.adsSelectorSeq, latestSyncLink)
syncCount, err := h.handle(ctx, nextCid, sel, syncer, h.subscriber.generalBlockHook, h.subscriber.segDepthLimit, stopAtCid)
if err != nil {
Expand Down
Loading