Fixing atomic bool check (#3376)

dev
Mzack9999 2023-03-05 20:07:40 +01:00 committed by GitHub
parent d7ac306bdf
commit 68550695f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -60,13 +60,16 @@ func (e *Engine) ExecuteScanWithOpts(templatesList []*templates.Template, target
// Execute All SelfContained in parallel
e.executeAllSelfContained(selfContained, results, selfcontainedWg)
var strategyResult *atomic.Bool
switch e.options.ScanStrategy {
case "template-spray":
results = e.executeTemplateSpray(filtered, target)
strategyResult = e.executeTemplateSpray(filtered, target)
case "host-spray":
results = e.executeHostSpray(filtered, target)
strategyResult = e.executeHostSpray(filtered, target)
}
results.CompareAndSwap(false, strategyResult.Load())
selfcontainedWg.Wait()
return results
}

View File

@ -13,9 +13,7 @@ import (
"github.com/remeh/sizedwaitgroup"
)
/*
Executors are low level executors that deals with template execution on a target
*/
// Executors are low level executors that deals with template execution on a target
// executeAllSelfContained executes all self contained templates that do not use `target`
func (e *Engine) executeAllSelfContained(alltemplates []*templates.Template, results *atomic.Bool, sg *sync.WaitGroup) {