Skip to content

Commit

Permalink
dv: remove extraneous goroutines
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsejet committed Jan 11, 2025
1 parent e7aa5d8 commit 0c9adec
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions dv/dv/prefix_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0c9adec

Please # to comment.