Move away from context

This commit is contained in:
kayos@tcp.direct 2023-02-01 21:46:47 -08:00
parent 273b7f5a07
commit dda56bab46
Signed by: kayos
GPG Key ID: 4B841471B4BEE979
2 changed files with 8 additions and 7 deletions

@ -1,7 +1,6 @@
package prox5
import (
"context"
"errors"
"sync/atomic"
)
@ -42,9 +41,10 @@ func (p5 *ProxyEngine) Pause() error {
p5.dbgPrint(simpleString("pausing proxy pool"))
p5.quit()
// p5.quit()
atomic.StoreUint32(&p5.Status, uint32(statePaused))
return nil
}
@ -58,7 +58,7 @@ func (p5 *ProxyEngine) Resume() error {
if p5.IsRunning() {
return errors.New("already running")
}
p5.ctx, p5.quit = context.WithCancel(context.Background())
// p5.ctx, p5.quit = context.WithCancel(context.Background())
p5.startDaemons()
return nil
}

@ -101,13 +101,14 @@ func (p5 *ProxyEngine) jobSpawner() {
go func() {
for {
select {
case <-p5.ctx.Done():
if !p5.IsRunning() {
q <- true
return
default:
}
// select {
// case <-p5.ctx.Done():
// default:
// }
if p5.Pending.Len() < 1 {
count := p5.recycling()
switch {