Don't waste the work items queued on testing the pools at startup.
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 79 80 81 82 83 84 85 86 87 88 89 90 91
diff --git a/main.c b/main.c
index be0129e..37d5306 100644
--- a/main.c
+++ b/main.c
@@ -2550,38 +2550,6 @@ int main (int argc, char *argv[])
} else
longpoll_thr_id = -1;
- /* Test each pool to see if we can retrieve and use work and for what
- * it supports */
- for (i = 0; i < total_pools; i++) {
- struct pool *pool;
- struct work work;
- json_t *val;
- CURL *curl;
-
- curl = curl_easy_init();
- if (unlikely(!curl)) {
- applog(LOG_ERR, "CURL initialisation failed");
- return 1;
- }
-
- pool = &pools[i];
- val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req,
- true, false, pool);
-
- if (val) {
- bool rc;
-
- rc = work_decode(json_object_get(val, "result"), &work);
- if (rc)
- applog(LOG_INFO, "Successfully retreived and deciphered work from pool %u %s", i, pool->rpc_url);
- else
- applog(LOG_WARNING, "Successfully retreived but FAILED to decipher work from pool %u %s", i, pool->rpc_url);
- json_decref(val);
- } else
- applog(LOG_WARNING, "FAILED to retrieve work from pool %u %s", i, pool->rpc_url);
- curl_easy_cleanup(curl);
- }
-
if (opt_n_threads ) {
cpus = calloc(num_processors, sizeof(struct cgpu_info));
if (unlikely(!cpus)) {
@@ -2619,6 +2587,47 @@ int main (int argc, char *argv[])
return 1;
}
+ /* Test each pool to see if we can retrieve and use work and for what
+ * it supports */
+ for (i = 0; i < total_pools; i++) {
+ struct pool *pool;
+ json_t *val;
+ CURL *curl;
+
+ curl = curl_easy_init();
+ if (unlikely(!curl)) {
+ applog(LOG_ERR, "CURL initialisation failed");
+ return 1;
+ }
+
+ pool = &pools[i];
+ val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req,
+ true, false, pool);
+
+ if (val) {
+ struct work *work = malloc(sizeof(struct work));
+ bool rc;
+
+ if (!work)
+ return 1;
+ rc = work_decode(json_object_get(val, "result"), work);
+ if (rc) {
+ applog(LOG_INFO, "Successfully retreived and deciphered work from pool %u %s", i, pool->rpc_url);
+ work->pool = pool;
+ tq_push(thr_info[stage_thr_id].q, work);
+ total_getworks++;
+ pool->getwork_requested++;
+ inc_queued();
+ } else {
+ applog(LOG_WARNING, "Successfully retreived but FAILED to decipher work from pool %u %s", i, pool->rpc_url);
+ free(work);
+ }
+ json_decref(val);
+ } else
+ applog(LOG_WARNING, "FAILED to retrieve work from pool %u %s", i, pool->rpc_url);
+ curl_easy_cleanup(curl);
+ }
+
#ifdef HAVE_OPENCL
i = 0;