|
@@ -62,11 +62,6 @@
|
|
|
# define USE_FPGA
|
|
# define USE_FPGA
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
-struct workio_cmd {
|
|
|
|
|
- struct work *work;
|
|
|
|
|
- struct pool *pool;
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
struct strategies strategies[] = {
|
|
struct strategies strategies[] = {
|
|
|
{ "Failover" },
|
|
{ "Failover" },
|
|
|
{ "Round Robin" },
|
|
{ "Round Robin" },
|
|
@@ -3084,10 +3079,10 @@ static void gen_stratum_work(struct pool *pool, struct work *work);
|
|
|
|
|
|
|
|
static void *get_work_thread(void *userdata)
|
|
static void *get_work_thread(void *userdata)
|
|
|
{
|
|
{
|
|
|
- struct workio_cmd *wc = (struct workio_cmd *)userdata;
|
|
|
|
|
|
|
+ struct pool *reqpool = (struct pool *)userdata;
|
|
|
|
|
+ struct pool *pool;
|
|
|
struct work *ret_work = NULL;
|
|
struct work *ret_work = NULL;
|
|
|
struct curl_ent *ce = NULL;
|
|
struct curl_ent *ce = NULL;
|
|
|
- struct pool *pool;
|
|
|
|
|
|
|
|
|
|
pthread_detach(pthread_self());
|
|
pthread_detach(pthread_self());
|
|
|
|
|
|
|
@@ -3096,7 +3091,7 @@ static void *get_work_thread(void *userdata)
|
|
|
applog(LOG_DEBUG, "Creating extra get work thread");
|
|
applog(LOG_DEBUG, "Creating extra get work thread");
|
|
|
|
|
|
|
|
retry:
|
|
retry:
|
|
|
- pool = wc->pool;
|
|
|
|
|
|
|
+ pool = reqpool;
|
|
|
|
|
|
|
|
if (pool->has_stratum) {
|
|
if (pool->has_stratum) {
|
|
|
while (!pool->stratum_active) {
|
|
while (!pool->stratum_active) {
|
|
@@ -3104,7 +3099,7 @@ retry:
|
|
|
|
|
|
|
|
sleep(5);
|
|
sleep(5);
|
|
|
if (altpool != pool) {
|
|
if (altpool != pool) {
|
|
|
- wc->pool = altpool;
|
|
|
|
|
|
|
+ reqpool = altpool;
|
|
|
inc_queued(altpool);
|
|
inc_queued(altpool);
|
|
|
dec_queued(pool);
|
|
dec_queued(pool);
|
|
|
goto retry;
|
|
goto retry;
|
|
@@ -3127,7 +3122,7 @@ retry:
|
|
|
|
|
|
|
|
sleep(5);
|
|
sleep(5);
|
|
|
if (altpool != pool) {
|
|
if (altpool != pool) {
|
|
|
- wc->pool = altpool;
|
|
|
|
|
|
|
+ reqpool = altpool;
|
|
|
inc_queued(altpool);
|
|
inc_queued(altpool);
|
|
|
dec_queued(pool);
|
|
dec_queued(pool);
|
|
|
goto retry;
|
|
goto retry;
|
|
@@ -3156,7 +3151,7 @@ retry:
|
|
|
get_benchmark_work(ret_work);
|
|
get_benchmark_work(ret_work);
|
|
|
ret_work->queued = true;
|
|
ret_work->queued = true;
|
|
|
} else {
|
|
} else {
|
|
|
- ret_work->pool = wc->pool;
|
|
|
|
|
|
|
+ ret_work->pool = reqpool;
|
|
|
|
|
|
|
|
if (!ce)
|
|
if (!ce)
|
|
|
ce = pop_curl_entry(pool);
|
|
ce = pop_curl_entry(pool);
|
|
@@ -3189,7 +3184,6 @@ retry:
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
out:
|
|
|
- free(wc);
|
|
|
|
|
if (ce)
|
|
if (ce)
|
|
|
push_curl_entry(ce, pool);
|
|
push_curl_entry(ce, pool);
|
|
|
return NULL;
|
|
return NULL;
|
|
@@ -5005,7 +4999,6 @@ static bool queue_request(void)
|
|
|
{
|
|
{
|
|
|
int ts, tq, maxq = opt_queue + mining_threads;
|
|
int ts, tq, maxq = opt_queue + mining_threads;
|
|
|
struct pool *pool, *cp;
|
|
struct pool *pool, *cp;
|
|
|
- struct workio_cmd *wc;
|
|
|
|
|
pthread_t get_thread;
|
|
pthread_t get_thread;
|
|
|
bool lagging;
|
|
bool lagging;
|
|
|
|
|
|
|
@@ -5025,19 +5018,10 @@ static bool queue_request(void)
|
|
|
|
|
|
|
|
inc_queued(pool);
|
|
inc_queued(pool);
|
|
|
|
|
|
|
|
- /* fill out work request message */
|
|
|
|
|
- wc = calloc(1, sizeof(*wc));
|
|
|
|
|
- if (unlikely(!wc)) {
|
|
|
|
|
- applog(LOG_ERR, "Failed to calloc wc in queue_request");
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- wc->pool = pool;
|
|
|
|
|
-
|
|
|
|
|
applog(LOG_DEBUG, "Queueing getwork request to work thread");
|
|
applog(LOG_DEBUG, "Queueing getwork request to work thread");
|
|
|
|
|
|
|
|
/* send work request to get_work_thread */
|
|
/* send work request to get_work_thread */
|
|
|
- if (unlikely(pthread_create(&get_thread, NULL, get_work_thread, (void *)wc)))
|
|
|
|
|
|
|
+ if (unlikely(pthread_create(&get_thread, NULL, get_work_thread, (void *)pool)))
|
|
|
quit(1, "Failed to create get_work_thread in queue_request");
|
|
quit(1, "Failed to create get_work_thread in queue_request");
|
|
|
|
|
|
|
|
return true;
|
|
return true;
|