mirror of
https://github.com/cryptonote-social/csminer.git
synced 2024-07-14 16:50:35 +03:00
fix potential null pointer dereference in login due to malformed response
This commit is contained in:
parent
5bc49e88fb
commit
c5509d787f
@ -12,7 +12,7 @@ import (
|
||||
|
||||
const (
|
||||
APPLICATION_NAME = "cryptonote.social Monero miner"
|
||||
VERSION_STRING = "0.3.2"
|
||||
VERSION_STRING = "0.3.3"
|
||||
STATS_WEBPAGE = "https://cryptonote.social/xmr"
|
||||
DONATE_USERNAME = "donate-getmonero-org"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
csminer v0.3.2 (Linux/Gnome version)
|
||||
csminer v0.3.3 (Linux/Gnome version)
|
||||
|
||||
SYNOPSIS
|
||||
|
||||
|
@ -385,10 +385,10 @@ func MiningLoop(jobChan <-chan *client.MultiClientJob, done chan<- bool) {
|
||||
cl.Close()
|
||||
newChan := reconnectClient()
|
||||
if newChan == nil {
|
||||
stopWorkers() // stop hashing if we're unable to reconnect since we can't submit shares
|
||||
crylog.Info("reconnect failed. sleeping for", sleepSec, "seconds before trying again")
|
||||
time.Sleep(sleepSec)
|
||||
sleepSec += time.Second
|
||||
stopWorkers() // stop hashing if we're unable to reconnect since we can't submit shares
|
||||
continue
|
||||
}
|
||||
// Set up fresh stats for new connection
|
||||
|
@ -230,13 +230,21 @@ func (cl *Client) Connect(
|
||||
return err, 0, "", nil
|
||||
}
|
||||
if response.Result == nil {
|
||||
crylog.Error("Didn't get job result from login response:", response.Error)
|
||||
return errors.New("stratum server error"), response.Error.Code, response.Error.Message, nil
|
||||
if response.Error != nil {
|
||||
crylog.Error("Didn't get job result from login response:", response.Error)
|
||||
return errors.New("stratum server error"), response.Error.Code, response.Error.Message, nil
|
||||
}
|
||||
crylog.Error("Malformed login response:", response)
|
||||
return errors.New("malformed login response"), 0, "", nil
|
||||
}
|
||||
|
||||
cl.responseChannel = make(chan *Response)
|
||||
cl.alive = true
|
||||
jc := make(chan *MultiClientJob)
|
||||
if response.Result.Job == nil {
|
||||
crylog.Error("malformed login response result:", response.Result)
|
||||
return errors.New("malformed login response case 2"), 0, "", nil
|
||||
}
|
||||
response.Result.Job.ChatToken = response.ChatToken
|
||||
go dispatchJobs(cl.conn, jc, response.Result.Job, cl.responseChannel)
|
||||
if response.Warning != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user