mirror of
https://github.com/chainreactors/spray.git
synced 2025-05-06 18:51:22 +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 {
|
||||
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
|
||||
r.Count = 1
|
||||
} else if len(opt.URL) > 1 {
|
||||
@ -446,7 +449,10 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
||||
}
|
||||
}
|
||||
|
||||
r.Count = r.Count * len(ports)
|
||||
if len(ports) > 0 {
|
||||
r.Count = r.Count * len(ports)
|
||||
}
|
||||
|
||||
r.Tasks = tasks
|
||||
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)
|
||||
}()
|
||||
|
||||
if len(r.Tasks) > 0 {
|
||||
r.bar = r.Progress.AddBar(len(r.Tasks))
|
||||
if r.Count > 0 {
|
||||
r.bar = r.Progress.AddBar(r.Count)
|
||||
r.bar.PrependCompleted()
|
||||
r.bar.PrependFunc(func(b *uiprogress.Bar) string {
|
||||
return fmt.Sprintf("total progressive: %d/%d ", r.finished, r.Count)
|
||||
|
Loading…
x
Reference in New Issue
Block a user