aboutsummaryrefslogtreecommitdiffstats
path: root/miner/remote_agent.go
diff options
context:
space:
mode:
Diffstat (limited to 'miner/remote_agent.go')
-rw-r--r--miner/remote_agent.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/miner/remote_agent.go b/miner/remote_agent.go
index 9e4453ce8..18ddf121c 100644
--- a/miner/remote_agent.go
+++ b/miner/remote_agent.go
@@ -48,9 +48,10 @@ type RemoteAgent struct {
}
func NewRemoteAgent() *RemoteAgent {
- agent := &RemoteAgent{work: make(map[common.Hash]*Work), hashrate: make(map[common.Hash]hashrate)}
-
- return agent
+ return &RemoteAgent{
+ work: make(map[common.Hash]*Work),
+ hashrate: make(map[common.Hash]hashrate),
+ }
}
func (a *RemoteAgent) SubmitHashrate(id common.Hash, rate uint64) {
@@ -75,8 +76,12 @@ func (a *RemoteAgent) Start() {
}
func (a *RemoteAgent) Stop() {
- close(a.quit)
- close(a.workCh)
+ if a.quit != nil {
+ close(a.quit)
+ }
+ if a.workCh != nil {
+ close(a.workCh)
+ }
}
// GetHashRate returns the accumulated hashrate of all identifier combined