Browse Source

As share submission is usually staggered, and delays can be costly, submit shares without delay even when --net-delay is enabled.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
09184720c2
  1. 8
      main.c
  2. 2
      miner.h
  3. 6
      util.c

8
main.c

@ -2331,7 +2331,7 @@ static bool submit_upstream_work(const struct work *work)
curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1); curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1);
/* issue JSON-RPC request */ /* 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)) { if (unlikely(!val)) {
applog(LOG_INFO, "submit_upstream_work json_rpc_call failed"); applog(LOG_INFO, "submit_upstream_work json_rpc_call failed");
if (!pool_tset(pool, &pool->submit_fail)) { if (!pool_tset(pool, &pool->submit_fail)) {
@ -2482,7 +2482,7 @@ retry:
* failure so retry a few times before giving up */ * failure so retry a few times before giving up */
while (!val && retries++ < 3) { while (!val && retries++ < 3) {
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req, 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 (donor(pool) && !val) {
if (opt_debug) if (opt_debug)
applog(LOG_DEBUG, "Donor pool lagging"); 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); applog(LOG_INFO, "Testing pool %s", pool->rpc_url);
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req, val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req,
true, false, &rolltime, pool); true, false, &rolltime, pool, false);
if (val) { if (val) {
struct work *work = make_work(); struct work *work = make_work();
@ -4721,7 +4721,7 @@ new_longpoll:
while (1) { while (1) {
gettimeofday(&start, NULL); gettimeofday(&start, NULL);
val = json_rpc_call(curl, lp_url, pool->rpc_userpass, rpc_req, val = json_rpc_call(curl, lp_url, pool->rpc_userpass, rpc_req,
false, true, &rolltime, pool); false, true, &rolltime, pool, false);
if (likely(val)) { if (likely(val)) {
convert_to_work(val, rolltime, pool); convert_to_work(val, rolltime, pool);
failures = 0; failures = 0;

2
miner.h

@ -452,7 +452,7 @@ extern pthread_rwlock_t netacc_lock;
extern const uint32_t sha256_init_state[]; extern const uint32_t sha256_init_state[];
extern json_t *json_rpc_call(CURL *curl, const char *url, const char *userpass, extern json_t *json_rpc_call(CURL *curl, const char *url, const char *userpass,
const char *rpc_req, bool, bool, bool *, 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 char *bin2hex(const unsigned char *p, size_t len);
extern bool hex2bin(unsigned char *p, const char *hexstr, size_t len); extern bool hex2bin(unsigned char *p, const char *hexstr, size_t len);

6
util.c

@ -305,7 +305,7 @@ static void set_nettime(void)
json_t *json_rpc_call(CURL *curl, const char *url, json_t *json_rpc_call(CURL *curl, const char *url,
const char *userpass, const char *rpc_req, const char *userpass, const char *rpc_req,
bool probe, bool longpoll, bool *rolltime, bool probe, bool longpoll, bool *rolltime,
struct pool *pool) struct pool *pool, bool share)
{ {
json_t *val, *err_val, *res_val; json_t *val, *err_val, *res_val;
int rc; 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_URL, url);
curl_easy_setopt(curl, CURLOPT_ENCODING, ""); curl_easy_setopt(curl, CURLOPT_ENCODING, "");
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1); 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_TCP_NODELAY, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data); 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); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
if (opt_delaynet) { if (opt_delaynet && !share) {
long long now_msecs, last_msecs; long long now_msecs, last_msecs;
struct timeval now, last; struct timeval now, last;

Loading…
Cancel
Save