From bc6cc544d90a30495e98b20b411d4d1d3d8bee64 Mon Sep 17 00:00:00 2001 From: M09Ic Date: Sat, 22 Feb 2025 02:49:50 +0800 Subject: [PATCH] fix: try fix deadlock, thanks https://github.com/chainreactors/spray/pull/89 --- internal/option.go | 2 +- internal/pool/brutepool.go | 3 ++- internal/utils.go | 22 ---------------------- 3 files changed, 3 insertions(+), 24 deletions(-) delete mode 100644 internal/utils.go diff --git a/internal/option.go b/internal/option.go index aff0f19..34f5836 100644 --- a/internal/option.go +++ b/internal/option.go @@ -96,7 +96,7 @@ type OutputOptions struct { } type RequestOptions struct { - Method string `short:"x" long:"method" default:"GET" description:"String, request method, e.g.: --method POST" config:"method"` + Method string `short:"X" long:"method" default:"GET" description:"String, request method, e.g.: --method POST" config:"method"` Headers []string `long:"header" description:"Strings, custom headers, e.g.: --header 'Auth: example_auth'" config:"headers"` UserAgent string `long:"user-agent" description:"String, custom user-agent, e.g.: --user-agent Custom" config:"useragent"` RandomUserAgent bool `long:"random-agent" description:"Bool, use random with default user-agent" config:"random-useragent"` diff --git a/internal/pool/brutepool.go b/internal/pool/brutepool.go index bd49aac..ad64cc7 100644 --- a/internal/pool/brutepool.go +++ b/internal/pool/brutepool.go @@ -329,10 +329,11 @@ func (pool *BrutePool) Invoke(v interface{}) { defer pool.initwg.Done() pool.locker.Lock() pool.random = bl + pool.locker.Unlock() + if !bl.IsValid { return } - pool.locker.Unlock() bl.Collect() pool.addFuzzyBaseline(bl) diff --git a/internal/utils.go b/internal/utils.go deleted file mode 100644 index 03ffaba..0000000 --- a/internal/utils.go +++ /dev/null @@ -1,22 +0,0 @@ -package internal - -//type bytesPatcher struct{} -// -//func (p *bytesPatcher) Visit(node *ast.Node) { -// switch (*node).(type) { -// case *ast.MemberNode: -// ast.Patch(node, &ast.CallNode{ -// Callee: &ast.MemberNode{ -// Node: *node, -// Name: "String", -// Property: &ast.StringNode{Value: "String"}, -// }, -// }) -// } -//} - -var ConfigTemplate = ` ------------------------------------------------------------ - ------------------------------------------------------------ -`