From bec89724d5649fe889712d985a9f7aaa4eb112b8 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Thu, 22 Jan 2015 05:55:50 +0100 Subject: [PATCH] logs: prevent multiple warnings --- ccminer.cpp | 2 +- util.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ccminer.cpp b/ccminer.cpp index b74e4d7..9a15de8 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -555,7 +555,7 @@ static int share_result(int result, const char *reason) applog(LOG_WARNING, "factor reduced to : %0.2f", opt_difficulty); return 0; } - if (strncmp(reason, "Duplicate share", 15) == 0) { + if (strncmp(reason, "Duplicate share", 15) == 0 && !check_dups) { applog(LOG_WARNING, "enabling duplicates check feature"); check_dups = true; } diff --git a/util.cpp b/util.cpp index ef9dc0c..a2e576f 100644 --- a/util.cpp +++ b/util.cpp @@ -1287,9 +1287,10 @@ static bool stratum_set_difficulty(struct stratum_ctx *sctx, json_t *params) pthread_mutex_unlock(&sctx->work_lock); /* store for api stats */ - global_diff = diff; - - applog(LOG_WARNING, "Stratum difficulty set to %g", diff); + if (diff != global_diff) { + global_diff = diff; + applog(LOG_WARNING, "Stratum difficulty set to %g", diff); + } return true; }