fix(proxy): align shutdown and custom diff fallback
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
066bc42a89
commit
46231ef0a3
3 changed files with 9 additions and 10 deletions
|
|
@ -183,12 +183,6 @@ func (p *Proxy) Stop() {
|
|||
server.Stop()
|
||||
}
|
||||
stopHTTPServer(p)
|
||||
if p.accessLogger != nil {
|
||||
p.accessLogger.close()
|
||||
}
|
||||
if p.shareLogger != nil {
|
||||
p.shareLogger.close()
|
||||
}
|
||||
if p.watcher != nil {
|
||||
p.watcher.Stop()
|
||||
}
|
||||
|
|
@ -216,6 +210,13 @@ func (p *Proxy) Stop() {
|
|||
shutdown.Disconnect()
|
||||
}
|
||||
|
||||
if p.accessLogger != nil {
|
||||
p.accessLogger.close()
|
||||
}
|
||||
if p.shareLogger != nil {
|
||||
p.shareLogger.close()
|
||||
}
|
||||
|
||||
select {
|
||||
case <-p.done:
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -162,8 +162,6 @@ func (customDiff *CustomDiff) OnLogin(event Event) {
|
|||
event.Miner.SetCustomDiff(value)
|
||||
return
|
||||
}
|
||||
event.Miner.SetCustomDiff(0)
|
||||
return
|
||||
}
|
||||
|
||||
if customDiff == nil {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ func TestCustomDiff_OnLogin_Bad(t *testing.T) {
|
|||
func TestCustomDiff_OnLogin_Ugly(t *testing.T) {
|
||||
miner := &Miner{user: "wallet+bad"}
|
||||
NewCustomDiff(100).OnLogin(Event{Miner: miner})
|
||||
if miner.User() != "wallet+bad" || miner.CustomDiff() != 0 {
|
||||
t.Fatalf("expected invalid suffix to preserve user and leave diff unset, got user=%q diff=%d", miner.User(), miner.CustomDiff())
|
||||
if miner.User() != "wallet+bad" || miner.CustomDiff() != 100 {
|
||||
t.Fatalf("expected invalid suffix to preserve user and fall back to global diff, got user=%q diff=%d", miner.User(), miner.CustomDiff())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue