From cb742f1bfb8d66fcf129ac97f16d617c52186600 Mon Sep 17 00:00:00 2001 From: gammazero Date: Thu, 28 Mar 2024 05:16:11 -0700 Subject: [PATCH] Do not create syncer if already at stopnode --- dagsync/subscriber.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dagsync/subscriber.go b/dagsync/subscriber.go index 0d8a170..dea7d66 100644 --- a/dagsync/subscriber.go +++ b/dagsync/subscriber.go @@ -857,15 +857,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 @@ -882,6 +873,15 @@ 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 {