refactor(proxy): clarify miner login callback naming
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
70fcbd4d43
commit
75d151b4e5
3 changed files with 5 additions and 5 deletions
2
miner.go
2
miner.go
|
|
@ -57,7 +57,7 @@ type Miner struct {
|
||||||
sendMu sync.Mutex // serialises writes to conn
|
sendMu sync.Mutex // serialises writes to conn
|
||||||
buf [16384]byte // per-miner send buffer; avoids per-write allocations
|
buf [16384]byte // per-miner send buffer; avoids per-write allocations
|
||||||
onLogin func(*Miner)
|
onLogin func(*Miner)
|
||||||
onLoginAccepted func(*Miner)
|
onLoginReady func(*Miner)
|
||||||
onSubmit func(*Miner, *SubmitEvent)
|
onSubmit func(*Miner, *SubmitEvent)
|
||||||
onClose func(*Miner)
|
onClose func(*Miner)
|
||||||
closeOnce sync.Once
|
closeOnce sync.Once
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ func TestMiner_HandleLogin_FailedAssignmentDoesNotDispatchLoginEvent(t *testing.
|
||||||
miner := NewMiner(minerConn, 3333, nil)
|
miner := NewMiner(minerConn, 3333, nil)
|
||||||
miner.extNH = true
|
miner.extNH = true
|
||||||
miner.onLogin = func(*Miner) {}
|
miner.onLogin = func(*Miner) {}
|
||||||
miner.onLoginAccepted = func(m *Miner) {
|
miner.onLoginReady = func(m *Miner) {
|
||||||
proxyInstance.events.Dispatch(Event{Type: EventLogin, Miner: m})
|
proxyInstance.events.Dispatch(Event{Type: EventLogin, Miner: m})
|
||||||
}
|
}
|
||||||
proxyInstance.miners[miner.ID()] = miner
|
proxyInstance.miners[miner.ID()] = miner
|
||||||
|
|
|
||||||
|
|
@ -456,7 +456,7 @@ func (p *Proxy) acceptMiner(conn net.Conn, localPort uint16) {
|
||||||
p.splitter.OnLogin(&LoginEvent{Miner: m})
|
p.splitter.OnLogin(&LoginEvent{Miner: m})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
miner.onLoginAccepted = func(m *Miner) {
|
miner.onLoginReady = func(m *Miner) {
|
||||||
if p.events != nil {
|
if p.events != nil {
|
||||||
p.events.Dispatch(Event{Type: EventLogin, Miner: m})
|
p.events.Dispatch(Event{Type: EventLogin, Miner: m})
|
||||||
}
|
}
|
||||||
|
|
@ -1032,8 +1032,8 @@ func (m *Miner) handleLogin(request stratumRequest) {
|
||||||
m.ReplyWithError(requestID(request.ID), "Proxy is unavailable, try again later")
|
m.ReplyWithError(requestID(request.ID), "Proxy is unavailable, try again later")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if m.onLoginAccepted != nil {
|
if m.onLoginReady != nil {
|
||||||
m.onLoginAccepted(m)
|
m.onLoginReady(m)
|
||||||
}
|
}
|
||||||
m.replyLoginSuccess(requestID(request.ID))
|
m.replyLoginSuccess(requestID(request.ID))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue