More debugging!
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
065ffcd3bb
commit
16fc55f38e
12
main.go
12
main.go
|
@ -106,11 +106,17 @@ func scanHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.WithField("contentType", contentType).Debug("Adding files from multipart form as jobs")
|
||||||
|
|
||||||
|
fileCount := 0
|
||||||
|
|
||||||
for _, files := range r.MultipartForm.File {
|
for _, files := range r.MultipartForm.File {
|
||||||
// Append files
|
// Append files
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
||||||
|
fileCount++
|
||||||
|
|
||||||
f, err := file.Open()
|
f, err := file.Open()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -126,6 +132,8 @@ func scanHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.WithField("count", fileCount).Debug("Waiting for jobs to finish")
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
json.NewEncoder(w).Encode(results)
|
json.NewEncoder(w).Encode(results)
|
||||||
|
@ -137,6 +145,8 @@ func scanHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.WithField("contentType", contentType).Debug("Scanning contents of body")
|
||||||
|
|
||||||
jobChan <- job
|
jobChan <- job
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,6 +214,8 @@ func worker(rules *yara.Rules) {
|
||||||
for {
|
for {
|
||||||
job := <-jobChan
|
job := <-jobChan
|
||||||
|
|
||||||
|
log.Debug("Processing job")
|
||||||
|
|
||||||
processJob(s, job)
|
processJob(s, job)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue