Fix recycling

This commit is contained in:
kayos@tcp.direct 2023-02-09 06:19:34 -08:00
parent 66223abe8e
commit ece90669f9
Signed by: kayos
GPG Key ID: 4B841471B4BEE979
3 changed files with 11 additions and 3 deletions

View File

@ -124,8 +124,15 @@ func (p5 *ProxyEngine) jobSpawner() {
continue continue
} }
var sock *Proxy
p5.Pending.Lock() p5.Pending.Lock()
sock := p5.Pending.Remove(p5.Pending.Front()).(*Proxy) switch p5.GetRecyclingStatus() {
case true:
el := p5.Pending.Front()
p5.Pending.MoveToBack(el)
sock = el.Value.(*Proxy)
}
p5.Pending.Unlock() p5.Pending.Unlock()
_ = p5.scale() _ = p5.scale()

View File

@ -68,7 +68,7 @@ type ProxyEngine struct {
stats *Statistics stats *Statistics
Status uint32 Status uint32
// Pending is a constant stream of proxy strings to be verified // Pending is a constant stream of proxy strings to be verified
Pending proxyList Pending proxyList

View File

@ -32,9 +32,10 @@ func (p5 *ProxyEngine) newHTTPClient() any {
}, },
} }
if timeout != time.Unix(0, 0) { if timeout != time.Duration(0) {
hc.Timeout = timeout hc.Timeout = timeout
} }
return hc
} }
// GetHTTPClient retrieves a pointer to an http.Client powered by mysteryDialer. // GetHTTPClient retrieves a pointer to an http.Client powered by mysteryDialer.