mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 11:40:13 +00:00
修复task count算错误的bug
This commit is contained in:
parent
77b92b44ea
commit
ccc9ca3719
@ -365,7 +365,10 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
u, _ = url.Parse("http://" + opt.URL[0])
|
u, _ = url.Parse("http://" + opt.URL[0])
|
||||||
}
|
}
|
||||||
go opt.GenerateTasks(tasks, u.Hostname(), ports)
|
go func() {
|
||||||
|
opt.GenerateTasks(tasks, u.Hostname(), ports)
|
||||||
|
close(tasks)
|
||||||
|
}()
|
||||||
taskfrom = u.Host
|
taskfrom = u.Host
|
||||||
r.Count = 1
|
r.Count = 1
|
||||||
} else if len(opt.URL) > 1 {
|
} else if len(opt.URL) > 1 {
|
||||||
@ -446,7 +449,10 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(ports) > 0 {
|
||||||
r.Count = r.Count * len(ports)
|
r.Count = r.Count * len(ports)
|
||||||
|
}
|
||||||
|
|
||||||
r.Tasks = tasks
|
r.Tasks = tasks
|
||||||
logs.Log.Importantf("Loaded %d urls from %s", len(tasks), taskfrom)
|
logs.Log.Importantf("Loaded %d urls from %s", len(tasks), taskfrom)
|
||||||
|
|
||||||
|
@ -155,8 +155,8 @@ func (r *Runner) Prepare(ctx context.Context) error {
|
|||||||
close(r.taskCh)
|
close(r.taskCh)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if len(r.Tasks) > 0 {
|
if r.Count > 0 {
|
||||||
r.bar = r.Progress.AddBar(len(r.Tasks))
|
r.bar = r.Progress.AddBar(r.Count)
|
||||||
r.bar.PrependCompleted()
|
r.bar.PrependCompleted()
|
||||||
r.bar.PrependFunc(func(b *uiprogress.Bar) string {
|
r.bar.PrependFunc(func(b *uiprogress.Bar) string {
|
||||||
return fmt.Sprintf("total progressive: %d/%d ", r.finished, r.Count)
|
return fmt.Sprintf("total progressive: %d/%d ", r.finished, r.Count)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user