From 09184720c293bbbef113cecfc829830a2a71f913 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 30 Jan 2012 15:09:58 +1100 Subject: [PATCH] As share submission is usually staggered, and delays can be costly, submit shares without delay even when --net-delay is enabled. --- main.c | 8 ++++---- miner.h | 2 +- util.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/main.c b/main.c index 850fbfe3..713253cc 100644 --- a/main.c +++ b/main.c @@ -2331,7 +2331,7 @@ static bool submit_upstream_work(const struct work *work) curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1); /* issue JSON-RPC request */ - val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, s, false, false, &rolltime, pool); + val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, s, false, false, &rolltime, pool, true); if (unlikely(!val)) { applog(LOG_INFO, "submit_upstream_work json_rpc_call failed"); if (!pool_tset(pool, &pool->submit_fail)) { @@ -2482,7 +2482,7 @@ retry: * failure so retry a few times before giving up */ while (!val && retries++ < 3) { val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req, - false, false, &work->rolltime, pool); + false, false, &work->rolltime, pool, false); if (donor(pool) && !val) { if (opt_debug) applog(LOG_DEBUG, "Donor pool lagging"); @@ -3993,7 +3993,7 @@ static bool pool_active(struct pool *pool, bool pinging) applog(LOG_INFO, "Testing pool %s", pool->rpc_url); val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req, - true, false, &rolltime, pool); + true, false, &rolltime, pool, false); if (val) { struct work *work = make_work(); @@ -4721,7 +4721,7 @@ new_longpoll: while (1) { gettimeofday(&start, NULL); val = json_rpc_call(curl, lp_url, pool->rpc_userpass, rpc_req, - false, true, &rolltime, pool); + false, true, &rolltime, pool, false); if (likely(val)) { convert_to_work(val, rolltime, pool); failures = 0; diff --git a/miner.h b/miner.h index 47e773d8..8f4e0357 100644 --- a/miner.h +++ b/miner.h @@ -452,7 +452,7 @@ extern pthread_rwlock_t netacc_lock; extern const uint32_t sha256_init_state[]; extern json_t *json_rpc_call(CURL *curl, const char *url, const char *userpass, const char *rpc_req, bool, bool, bool *, - struct pool *pool); + struct pool *pool, bool); extern char *bin2hex(const unsigned char *p, size_t len); extern bool hex2bin(unsigned char *p, const char *hexstr, size_t len); diff --git a/util.c b/util.c index aab5070e..733d8ad3 100644 --- a/util.c +++ b/util.c @@ -305,7 +305,7 @@ static void set_nettime(void) json_t *json_rpc_call(CURL *curl, const char *url, const char *userpass, const char *rpc_req, bool probe, bool longpoll, bool *rolltime, - struct pool *pool) + struct pool *pool, bool share) { json_t *val, *err_val, *res_val; int rc; @@ -336,7 +336,7 @@ json_t *json_rpc_call(CURL *curl, const char *url, curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_ENCODING, ""); curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1); - if (!opt_delaynet) + if (!opt_delaynet || share) curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data); @@ -380,7 +380,7 @@ json_t *json_rpc_call(CURL *curl, const char *url, curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); - if (opt_delaynet) { + if (opt_delaynet && !share) { long long now_msecs, last_msecs; struct timeval now, last;