|
@@ -2550,38 +2550,6 @@ int main (int argc, char *argv[])
|
|
|
} else
|
|
} else
|
|
|
longpoll_thr_id = -1;
|
|
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 ) {
|
|
if (opt_n_threads ) {
|
|
|
cpus = calloc(num_processors, sizeof(struct cgpu_info));
|
|
cpus = calloc(num_processors, sizeof(struct cgpu_info));
|
|
|
if (unlikely(!cpus)) {
|
|
if (unlikely(!cpus)) {
|
|
@@ -2619,6 +2587,47 @@ int main (int argc, char *argv[])
|
|
|
return 1;
|
|
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
|
|
#ifdef HAVE_OPENCL
|
|
|
i = 0;
|
|
i = 0;
|
|
|
|
|
|