diff --git a/minerlib/chat/chat.go b/minerlib/chat/chat.go index ddf5cd0..e8fd6b7 100644 --- a/minerlib/chat/chat.go +++ b/minerlib/chat/chat.go @@ -54,15 +54,15 @@ func ChatSent(id int) { } func ChatsReceived(chats []client.ChatResult, chatToken int, fetchedToken int) { - if len(chats) == 0 { - return + if len(chats) != 0 { + crylog.Info("Chats received:", chats) } - crylog.Info("Chats received:", chats) mutex.Lock() defer mutex.Unlock() if nextToken != fetchedToken { - crylog.Warn("Skipping dupe chats:", chats) - return // these chats are already handled + // Another chat request must have succeeded before this one. + crylog.Warn("chats updated since this fetch, discarding:", chats) + return } for i := range chats { receivedQueue = append(receivedQueue, &chats[i]) diff --git a/minerlib/minerlib.go b/minerlib/minerlib.go index a444acc..26dbe29 100644 --- a/minerlib/minerlib.go +++ b/minerlib/minerlib.go @@ -390,6 +390,7 @@ func MiningLoop(jobChan <-chan *client.MultiClientJob, done chan<- bool) { } case <-time.After(30 * time.Second): + go GetChats() break } @@ -695,8 +696,7 @@ func goMine(job client.MultiClientJob, thread int) { crylog.Warn("Didn't get pool stats in response:", resp.Result) updatePoolStats(true) } - //crylog.Info("Chat token:", resp.ChatToken, chat.NextToken()) - if resp.ChatToken > 0 && resp.ChatToken != chat.NextToken() { + if resp.ChatToken != chat.NextToken() { go GetChats() } }(fnonce, job.JobID)