Rework the pool fail to connect at startup to not get stuck indefinitely repeatedly probing pools with new threads and to exit immediately when any key is pressed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
diff --git a/cgminer.c b/cgminer.c
index 27d2915..304185c 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -8544,10 +8544,11 @@ static void initialise_usb(void) {
int main(int argc, char *argv[])
{
struct sigaction handler;
+ bool pool_msg = false;
struct thr_info *thr;
struct block *block;
+ int i, j, slept = 0;
unsigned int k;
- int i, j;
char *s;
/* This dangerous functions tramples random dynamically allocated
@@ -8866,40 +8867,38 @@ int main(int argc, char *argv[])
pool->idle = true;
}
+ /* Look for at least one active pool before starting */
applog(LOG_NOTICE, "Probing for an alive pool");
+ probe_pools();
do {
- int slept = 0;
-
- /* Look for at least one active pool before starting */
- probe_pools();
- do {
- sleep(1);
- slept++;
- } while (!pools_active && slept < 60);
+ sleep(1);
+ slept++;
+ } while (!pools_active && slept < 60);
- if (!pools_active) {
+ while (!pools_active) {
+ if (!pool_msg) {
applog(LOG_ERR, "No servers were found that could be used to get work from.");
applog(LOG_ERR, "Please check the details from the list below of the servers you have input");
applog(LOG_ERR, "Most likely you have input the wrong URL, forgotten to add a port, or have not set up workers");
for (i = 0; i < total_pools; i++) {
- struct pool *pool;
+ struct pool *pool = pools[i];
- pool = pools[i];
applog(LOG_WARNING, "Pool: %d URL: %s User: %s Password: %s",
- i, pool->rpc_url, pool->rpc_user, pool->rpc_pass);
+ i, pool->rpc_url, pool->rpc_user, pool->rpc_pass);
}
+ pool_msg = true;
+ if (use_curses)
+ applog(LOG_ERR, "Press any key to exit, or cgminer will wait indefinitely for an alive pool.");
+ }
+ if (!use_curses)
+ early_quit(0, "No servers could be used! Exiting.");
#ifdef HAVE_CURSES
- if (use_curses) {
- halfdelay(255);
- applog(LOG_ERR, "Press any key to exit, or cgminer will try again in 30s.");
- if (getch() != ERR)
- early_quit(0, "No servers could be used! Exiting.");
- cbreak();
- } else
+ halfdelay(10);
+ if (getch() != ERR)
+ early_quit(0, "No servers could be used! Exiting.");
+ cbreak();
#endif
- early_quit(0, "No servers could be used! Exiting.");
- }
- } while (!pools_active);
+ };
begin_bench:
total_mhashes_done = 0;