From 0c9adeca619d82880240fc1bbc790cfda6792640 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sat, 11 Jan 2025 19:51:51 +0000 Subject: [PATCH] dv: remove extraneous goroutines --- dv/dv/prefix_sync.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/dv/dv/prefix_sync.go b/dv/dv/prefix_sync.go index 180db5a..42fd868 100644 --- a/dv/dv/prefix_sync.go +++ b/dv/dv/prefix_sync.go @@ -17,7 +17,7 @@ func (dv *Router) prefixDataFetchAll() { for _, e := range dv.rib.Entries() { router := dv.pfx.GetRouter(e.Name()) if router != nil && router.Known < router.Latest { - go dv.prefixDataFetch(e.Name()) + dv.prefixDataFetch(e.Name()) } } } @@ -38,14 +38,11 @@ func (dv *Router) onPfxSyncUpdate(ssu ndn_sync.SvSyncUpdate) { r.Latest = ssu.High // Start a fetching thread (if needed) - go dv.prefixDataFetch(ssu.Name) + dv.prefixDataFetch(ssu.Name) } -// Fetch prefix data +// Fetch prefix data (call with lock held) func (dv *Router) prefixDataFetch(nName enc.Name) { - dv.mutex.Lock() - defer dv.mutex.Unlock() - // Check if the RIB has this destination if !dv.rib.Has(nName) { return @@ -86,7 +83,7 @@ func (dv *Router) prefixDataFetch(nName enc.Name) { // Done fetching, restart if needed router.Fetching = false - go dv.prefixDataFetch(nName) + dv.prefixDataFetch(nName) }() return true