fix: stratum deadlock + contrib-row CSS + README update for recent features
This commit is contained in:
@@ -203,7 +203,10 @@ func (s *StratumClient) runPool(ep stratumEndpoint, stopCh <-chan struct{}) erro
|
||||
}
|
||||
})
|
||||
|
||||
// Submit writer goroutine.
|
||||
// innerDone is closed when runPool returns for any reason (connection error
|
||||
// or stopCh). It signals the submit goroutine to exit even when stopCh is
|
||||
// still open, preventing a hang until the next share arrives.
|
||||
innerDone := make(chan struct{})
|
||||
submitDone := make(chan struct{})
|
||||
go func() {
|
||||
defer close(submitDone)
|
||||
@@ -211,6 +214,8 @@ func (s *StratumClient) runPool(ep stratumEndpoint, stopCh <-chan struct{}) erro
|
||||
select {
|
||||
case <-stopCh:
|
||||
return
|
||||
case <-innerDone:
|
||||
return
|
||||
case share, ok := <-shareCh:
|
||||
if !ok {
|
||||
return
|
||||
@@ -235,7 +240,22 @@ func (s *StratumClient) runPool(ep stratumEndpoint, stopCh <-chan struct{}) erro
|
||||
}
|
||||
}
|
||||
}()
|
||||
defer func() { <-submitDone }()
|
||||
// Signal the submit goroutine and wait for it when runPool returns.
|
||||
defer func() {
|
||||
close(innerDone)
|
||||
<-submitDone
|
||||
}()
|
||||
|
||||
// Close the TCP connection as soon as stopCh fires so that the blocking
|
||||
// reader.ReadString call (120 s deadline) unblocks immediately rather than
|
||||
// making callers wait up to two minutes for the fallback to stop.
|
||||
go func() {
|
||||
select {
|
||||
case <-stopCh:
|
||||
_ = conn.Close()
|
||||
case <-innerDone:
|
||||
}
|
||||
}()
|
||||
|
||||
// ── Job receive loop ──────────────────────────────────────────────────────
|
||||
// keepalive every 60 s
|
||||
|
||||
Reference in New Issue
Block a user