*';
+ $pg .= ' A value of 0, less than the pool default, ';
+ $pg .= 'or less than the pool calculated value for you, ';
+ $pg .= 'will use the pool calculated value
';
$pg .= "\n";
return $pg;
diff --git a/src/ckdb.h b/src/ckdb.h
index 37fadec1..a03ba095 100644
--- a/src/ckdb.h
+++ b/src/ckdb.h
@@ -52,7 +52,7 @@
#define DB_VLOCK "1"
#define DB_VERSION "0.9.2"
-#define CKDB_VERSION DB_VERSION"-0.405"
+#define CKDB_VERSION DB_VERSION"-0.406"
#define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__
@@ -597,15 +597,17 @@ extern K_LIST *workers_free;
extern K_STORE *workers_store;
#define DIFFICULTYDEFAULT_MIN 10
-#define DIFFICULTYDEFAULT_MAX 1000000
-#define DIFFICULTYDEFAULT_DEF DIFFICULTYDEFAULT_MIN
+#define DIFFICULTYDEFAULT_MAX 0x7fffffff
+// 0 means it's not set
+#define DIFFICULTYDEFAULT_DEF 0
#define DIFFICULTYDEFAULT_DEF_STR STRINT(DIFFICULTYDEFAULT_DEF)
#define IDLENOTIFICATIONENABLED "y"
#define IDLENOTIFICATIONDISABLED " "
#define IDLENOTIFICATIONENABLED_DEF IDLENOTIFICATIONDISABLED
#define IDLENOTIFICATIONTIME_MIN 10
#define IDLENOTIFICATIONTIME_MAX 60
-#define IDLENOTIFICATIONTIME_DEF IDLENOTIFICATIONTIME_MIN
+// 0 means it's not set and will be flagged disabled
+#define IDLENOTIFICATIONTIME_DEF 0
#define IDLENOTIFICATIONTIME_DEF_STR STRINT(IDLENOTIFICATIONTIME_DEF)
// PAYMENTADDRESSES
diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c
index b5abc749..77c27c4e 100644
--- a/src/ckdb_cmd.c
+++ b/src/ckdb_cmd.c
@@ -355,10 +355,12 @@ static char *cmd_workerset(PGconn *conn, char *cmd, char *id, tv_t *now,
continue;
difficultydefault = atoi(transfer_data(i_diffdef));
- if (difficultydefault < DIFFICULTYDEFAULT_MIN)
- difficultydefault = DIFFICULTYDEFAULT_MIN;
- if (difficultydefault > DIFFICULTYDEFAULT_MAX)
- difficultydefault = DIFFICULTYDEFAULT_MAX;
+ if (difficultydefault != 0) {
+ if (difficultydefault < DIFFICULTYDEFAULT_MIN)
+ difficultydefault = DIFFICULTYDEFAULT_MIN;
+ if (difficultydefault > DIFFICULTYDEFAULT_MAX)
+ difficultydefault = DIFFICULTYDEFAULT_MAX;
+ }
if (workers->difficultydefault != difficultydefault) {
/* This uses a seperate txn per update
diff --git a/src/ckdb_dbio.c b/src/ckdb_dbio.c
index a7f4a2e2..4033f13f 100644
--- a/src/ckdb_dbio.c
+++ b/src/ckdb_dbio.c
@@ -1068,6 +1068,7 @@ K_ITEM *workers_add(PGconn *conn, int64_t userid, char *workername,
conned = true;
}
+ bzero(row, sizeof(*row));
row->workerid = nextid(conn, "workerid", (int64_t)1, cd, by, code, inet);
if (row->workerid == 0)
goto unitem;
@@ -1076,10 +1077,13 @@ K_ITEM *workers_add(PGconn *conn, int64_t userid, char *workername,
STRNCPY(row->workername, workername);
if (difficultydefault && *difficultydefault) {
diffdef = atoi(difficultydefault);
- if (diffdef < DIFFICULTYDEFAULT_MIN)
- diffdef = DIFFICULTYDEFAULT_MIN;
- if (diffdef > DIFFICULTYDEFAULT_MAX)
- diffdef = DIFFICULTYDEFAULT_MAX;
+ // If out of the range, set it in the range
+ if (diffdef != DIFFICULTYDEFAULT_DEF) {
+ if (diffdef < DIFFICULTYDEFAULT_MIN)
+ diffdef = DIFFICULTYDEFAULT_MIN;
+ if (diffdef > DIFFICULTYDEFAULT_MAX)
+ diffdef = DIFFICULTYDEFAULT_MAX;
+ }
row->difficultydefault = diffdef;
} else
row->difficultydefault = DIFFICULTYDEFAULT_DEF;
@@ -1095,15 +1099,20 @@ K_ITEM *workers_add(PGconn *conn, int64_t userid, char *workername,
if (idlenotificationtime && *idlenotificationtime) {
nottime = atoi(idlenotificationtime);
- if (nottime < DIFFICULTYDEFAULT_MIN) {
- row->idlenotificationenabled[0] = IDLENOTIFICATIONDISABLED[0];
- nottime = DIFFICULTYDEFAULT_MIN;
- } else if (nottime > IDLENOTIFICATIONTIME_MAX)
- nottime = row->idlenotificationtime;
+ if (nottime != IDLENOTIFICATIONTIME_DEF) {
+ // If out of the range, set to default
+ if (nottime < IDLENOTIFICATIONTIME_MIN ||
+ nottime > IDLENOTIFICATIONTIME_MAX)
+ nottime = IDLENOTIFICATIONTIME_DEF;
+ }
row->idlenotificationtime = nottime;
} else
row->idlenotificationtime = IDLENOTIFICATIONTIME_DEF;
+ // Default is disabled
+ if (row->idlenotificationtime == IDLENOTIFICATIONTIME_DEF)
+ row->idlenotificationenabled[0] = IDLENOTIFICATIONDISABLED[0];
+
HISTORYDATEINIT(row, cd, by, code, inet);
HISTORYDATETRANSFER(trf_root, row);