Browse Source

Add not no utf8 flag to json we know will only contain ascii

master
Con Kolivas 11 years ago
parent
commit
f794f4afab
  1. 8
      src/generator.c
  2. 8
      src/stratifier.c

8
src/generator.c

@ -263,7 +263,7 @@ retry:
send_unix_msg(sockd, "Failed"); send_unix_msg(sockd, "Failed");
goto reconnect; goto reconnect;
} else { } else {
char *s = json_dumps(gbt->json, 0); char *s = json_dumps(gbt->json, JSON_NO_UTF8);
send_unix_msg(sockd, s); send_unix_msg(sockd, s);
free(s); free(s);
@ -915,7 +915,7 @@ static void send_subscribe(proxy_instance_t *proxi, int sockd)
json_msg = json_pack("{sssi}", "enonce1", proxi->enonce1, json_msg = json_pack("{sssi}", "enonce1", proxi->enonce1,
"nonce2len", proxi->nonce2len); "nonce2len", proxi->nonce2len);
msg = json_dumps(json_msg, 0); msg = json_dumps(json_msg, JSON_NO_UTF8);
json_decref(json_msg); json_decref(json_msg);
send_unix_msg(sockd, msg); send_unix_msg(sockd, msg);
free(msg); free(msg);
@ -944,7 +944,7 @@ static void send_notify(proxy_instance_t *proxi, int sockd)
"clean", ni->clean); "clean", ni->clean);
mutex_unlock(&proxi->notify_lock); mutex_unlock(&proxi->notify_lock);
msg = json_dumps(json_msg, 0); msg = json_dumps(json_msg, JSON_NO_UTF8);
json_decref(json_msg); json_decref(json_msg);
send_unix_msg(sockd, msg); send_unix_msg(sockd, msg);
free(msg); free(msg);
@ -957,7 +957,7 @@ static void send_diff(proxy_instance_t *proxi, int sockd)
char *msg; char *msg;
json_msg = json_pack("{sf}", "diff", proxi->diff); json_msg = json_pack("{sf}", "diff", proxi->diff);
msg = json_dumps(json_msg, 0); msg = json_dumps(json_msg, JSON_NO_UTF8);
json_decref(json_msg); json_decref(json_msg);
send_unix_msg(sockd, msg); send_unix_msg(sockd, msg);
free(msg); free(msg);

8
src/stratifier.c

@ -2368,7 +2368,7 @@ static void *statsupdate(void *arg)
"runtime", diff.tv_sec, "runtime", diff.tv_sec,
"Users", stats.users, "Users", stats.users,
"Workers", stats.workers); "Workers", stats.workers);
s = json_dumps(val, 0); s = json_dumps(val, JSON_NO_UTF8);
json_decref(val); json_decref(val);
LOGNOTICE("Pool:%s", s); LOGNOTICE("Pool:%s", s);
fprintf(fp, "%s\n", s); fprintf(fp, "%s\n", s);
@ -2381,7 +2381,7 @@ static void *statsupdate(void *arg)
"hashrate1hr", suffix60, "hashrate1hr", suffix60,
"hashrate6hr", suffix360, "hashrate6hr", suffix360,
"hashrate1d", suffix1440); "hashrate1d", suffix1440);
s = json_dumps(val, 0); s = json_dumps(val, JSON_NO_UTF8);
json_decref(val); json_decref(val);
LOGNOTICE("Pool:%s", s); LOGNOTICE("Pool:%s", s);
fprintf(fp, "%s\n", s); fprintf(fp, "%s\n", s);
@ -2392,7 +2392,7 @@ static void *statsupdate(void *arg)
"SPS5m", sps5, "SPS5m", sps5,
"SPS15m", sps15, "SPS15m", sps15,
"SPS1h", sps60); "SPS1h", sps60);
s = json_dumps(val, 0); s = json_dumps(val, JSON_NO_UTF8);
json_decref(val); json_decref(val);
LOGNOTICE("Pool:%s", s); LOGNOTICE("Pool:%s", s);
fprintf(fp, "%s\n", s); fprintf(fp, "%s\n", s);
@ -2439,7 +2439,7 @@ static void *statsupdate(void *arg)
LOGERR("Failed to fopen %s", fname); LOGERR("Failed to fopen %s", fname);
continue; continue;
} }
s = json_dumps(val, 0); s = json_dumps(val, JSON_NO_UTF8);
fprintf(fp, "%s\n", s); fprintf(fp, "%s\n", s);
/* Only display the status of connected users to the /* Only display the status of connected users to the
* console log. */ * console log. */

Loading…
Cancel
Save