mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 01:04:02 +03:00
Set worker pool to non-blocking mode
This commit is contained in:
+4
-2
@@ -328,7 +328,7 @@ func NewProxy(opts ProxyOpts) (*Proxy, error) { // nolint: cyclop, funlen
|
|||||||
ipBlocklist: opts.IPBlocklist,
|
ipBlocklist: opts.IPBlocklist,
|
||||||
eventStream: opts.EventStream,
|
eventStream: opts.EventStream,
|
||||||
logger: opts.Logger.Named("proxy"),
|
logger: opts.Logger.Named("proxy"),
|
||||||
domainFrontingPort: int(domainFrontingPort),
|
domainFrontingPort: domainFrontingPort,
|
||||||
idleTimeout: idleTimeout,
|
idleTimeout: idleTimeout,
|
||||||
bufferSize: int(bufferSize),
|
bufferSize: int(bufferSize),
|
||||||
telegram: tg,
|
telegram: tg,
|
||||||
@@ -336,7 +336,9 @@ func NewProxy(opts ProxyOpts) (*Proxy, error) { // nolint: cyclop, funlen
|
|||||||
|
|
||||||
pool, err := ants.NewPoolWithFunc(int(concurrency), func(arg interface{}) {
|
pool, err := ants.NewPoolWithFunc(int(concurrency), func(arg interface{}) {
|
||||||
proxy.ServeConn(arg.(net.Conn))
|
proxy.ServeConn(arg.(net.Conn))
|
||||||
}, ants.WithLogger(opts.Logger.Named("ants")))
|
},
|
||||||
|
ants.WithLogger(opts.Logger.Named("ants")),
|
||||||
|
ants.WithNonblocking(true))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("cannot initialize a pool: %w", err)
|
return nil, fmt.Errorf("cannot initialize a pool: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user