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
|
||||
buf [16384]byte // per-miner send buffer; avoids per-write allocations
|
||||
onLogin func(*Miner)
|
||||
onLoginAccepted func(*Miner)
|
||||
onLoginReady func(*Miner)
|
||||
onSubmit func(*Miner, *SubmitEvent)
|
||||
onClose func(*Miner)
|
||||
closeOnce sync.Once
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ func TestMiner_HandleLogin_FailedAssignmentDoesNotDispatchLoginEvent(t *testing.
|
|||
miner := NewMiner(minerConn, 3333, nil)
|
||||
miner.extNH = true
|
||||
miner.onLogin = func(*Miner) {}
|
||||
miner.onLoginAccepted = func(m *Miner) {
|
||||
miner.onLoginReady = func(m *Miner) {
|
||||
proxyInstance.events.Dispatch(Event{Type: EventLogin, Miner: m})
|
||||
}
|
||||
proxyInstance.miners[miner.ID()] = miner
|
||||
|
|
|
|||
|
|
@ -456,7 +456,7 @@ func (p *Proxy) acceptMiner(conn net.Conn, localPort uint16) {
|
|||
p.splitter.OnLogin(&LoginEvent{Miner: m})
|
||||
}
|
||||
}
|
||||
miner.onLoginAccepted = func(m *Miner) {
|
||||
miner.onLoginReady = func(m *Miner) {
|
||||
if p.events != nil {
|
||||
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")
|
||||
return
|
||||
}
|
||||
if m.onLoginAccepted != nil {
|
||||
m.onLoginAccepted(m)
|
||||
if m.onLoginReady != nil {
|
||||
m.onLoginReady(m)
|
||||
}
|
||||
m.replyLoginSuccess(requestID(request.ID))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue