Browse Source

tui: Refactor status line printing.

Default pool name is now URL and port instead of "Pool N" (which
is confusing).

Status line displays user-defined name.
nfactor-troky
Noel Maersk 11 years ago
parent
commit
22b78e91f6
  1. 2
      miner.h
  2. 22
      sgminer.c

2
miner.h

@ -1234,6 +1234,7 @@ struct pool { @@ -1234,6 +1234,7 @@ struct pool {
char prev_block[32];
/* Stratum variables */
bool has_stratum;
char *stratum_url;
char *stratum_port;
struct addrinfo stratum_hints;
@ -1250,7 +1251,6 @@ struct pool { @@ -1250,7 +1251,6 @@ struct pool {
uint64_t nonce2;
int n2size;
char *sessionid;
bool has_stratum;
bool stratum_active;
bool stratum_init;
bool stratum_notify;

22
sgminer.c

@ -509,9 +509,15 @@ struct pool *add_pool(void) @@ -509,9 +509,15 @@ struct pool *add_pool(void)
if (!pool)
quit(1, "Failed to malloc pool in add_pool");
pool->pool_no = pool->prio = total_pools;
/* Default pool name */
char buf[32];
sprintf(buf, "Pool %d", pool->pool_no);
sprintf(buf, "%s%s%s",
pool->sockaddr_url,
pool->has_stratum ? ":" : "",
pool->has_stratum ? pool->stratum_port : "");
pool->poolname = strdup(buf);
pools = realloc(pools, sizeof(struct pool *) * (total_pools + 2));
pools[total_pools++] = pool;
mutex_init(&pool->pool_lock);
@ -2108,15 +2114,13 @@ static void curses_print_status(void) @@ -2108,15 +2114,13 @@ static void curses_print_status(void)
local_work, total_go, total_ro);
wclrtoeol(statuswin);
if (shared_strategy() && total_pools > 1) {
cg_mvwprintw(statuswin, 4, 0, "Connected to multiple pools with%s block change notify",
have_longpoll ? "": "out");
} else if (pool->has_stratum) {
cg_mvwprintw(statuswin, 4, 0, "Connected to %s:%s diff %s with stratum as user %s",
pool->sockaddr_url, pool->stratum_port, pool->diff, pool->rpc_user);
cg_mvwprintw(statuswin, 4, 0, "Connected to multiple pools %s block change notify",
have_longpoll ? "with": "without");
} else {
cg_mvwprintw(statuswin, 4, 0, "Connected to %s diff %s with%s %s as user %s",
pool->sockaddr_url, pool->diff, have_longpoll ? "": "out",
pool->has_gbt ? "GBT" : "LP", pool->rpc_user);
cg_mvwprintw(statuswin, 4, 0, "Connected to %s (%s) diff %s as user %s",
pool->poolname,
pool->has_stratum ? "stratum" : (pool->has_gbt ? "GBT" : "longpoll"),
pool->diff, pool->rpc_user);
}
wclrtoeol(statuswin);
cg_mvwprintw(statuswin, 5, 0, "Block: %s... Diff:%s Started: %s Best share: %s ",

Loading…
Cancel
Save