|
|
@ -275,6 +275,7 @@ json_t *json_rpc_call(CURL *curl, const char *url, |
|
|
|
struct upload_buffer upload_data; |
|
|
|
struct upload_buffer upload_data; |
|
|
|
json_t *val, *err_val, *res_val; |
|
|
|
json_t *val, *err_val, *res_val; |
|
|
|
bool probing = false; |
|
|
|
bool probing = false; |
|
|
|
|
|
|
|
double byte_count; |
|
|
|
json_error_t err; |
|
|
|
json_error_t err; |
|
|
|
int rc; |
|
|
|
int rc; |
|
|
|
|
|
|
|
|
|
|
@ -384,6 +385,13 @@ json_t *json_rpc_call(CURL *curl, const char *url, |
|
|
|
goto err_out; |
|
|
|
goto err_out; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pool->cgminer_pool_stats.times_sent++; |
|
|
|
|
|
|
|
if (curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &byte_count) == CURLE_OK) |
|
|
|
|
|
|
|
pool->cgminer_pool_stats.bytes_sent += byte_count; |
|
|
|
|
|
|
|
pool->cgminer_pool_stats.times_received++; |
|
|
|
|
|
|
|
if (curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &byte_count) == CURLE_OK) |
|
|
|
|
|
|
|
pool->cgminer_pool_stats.bytes_received += byte_count; |
|
|
|
|
|
|
|
|
|
|
|
if (probing) { |
|
|
|
if (probing) { |
|
|
|
pool->probed = true; |
|
|
|
pool->probed = true; |
|
|
|
/* If X-Long-Polling was found, activate long polling */ |
|
|
|
/* If X-Long-Polling was found, activate long polling */ |
|
|
@ -900,6 +908,8 @@ static bool __stratum_send(struct pool *pool, char *s, ssize_t len) |
|
|
|
len -= ssent; |
|
|
|
len -= ssent; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pool->cgminer_pool_stats.times_sent++; |
|
|
|
|
|
|
|
pool->cgminer_pool_stats.bytes_sent += ssent; |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1000,6 +1010,9 @@ char *recv_line(struct pool *pool) |
|
|
|
memmove(pool->sockbuf, pool->sockbuf + len + 1, buflen - len + 1); |
|
|
|
memmove(pool->sockbuf, pool->sockbuf + len + 1, buflen - len + 1); |
|
|
|
else |
|
|
|
else |
|
|
|
strcpy(pool->sockbuf, ""); |
|
|
|
strcpy(pool->sockbuf, ""); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pool->cgminer_pool_stats.times_received++; |
|
|
|
|
|
|
|
pool->cgminer_pool_stats.bytes_received += len; |
|
|
|
out: |
|
|
|
out: |
|
|
|
if (!sret) |
|
|
|
if (!sret) |
|
|
|
clear_sock(pool); |
|
|
|
clear_sock(pool); |
|
|
@ -1311,6 +1324,7 @@ bool initiate_stratum(struct pool *pool) |
|
|
|
char curl_err_str[CURL_ERROR_SIZE]; |
|
|
|
char curl_err_str[CURL_ERROR_SIZE]; |
|
|
|
char s[RBUFSIZE], *sret = NULL; |
|
|
|
char s[RBUFSIZE], *sret = NULL; |
|
|
|
CURL *curl = NULL; |
|
|
|
CURL *curl = NULL; |
|
|
|
|
|
|
|
double byte_count; |
|
|
|
json_error_t err; |
|
|
|
json_error_t err; |
|
|
|
bool ret = false; |
|
|
|
bool ret = false; |
|
|
|
|
|
|
|
|
|
|
@ -1350,6 +1364,13 @@ bool initiate_stratum(struct pool *pool) |
|
|
|
curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, (long *)&pool->sock); |
|
|
|
curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, (long *)&pool->sock); |
|
|
|
keep_alive(curl, pool->sock); |
|
|
|
keep_alive(curl, pool->sock); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pool->cgminer_pool_stats.times_sent++; |
|
|
|
|
|
|
|
if (curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &byte_count) == CURLE_OK) |
|
|
|
|
|
|
|
pool->cgminer_pool_stats.bytes_sent += byte_count; |
|
|
|
|
|
|
|
pool->cgminer_pool_stats.times_received++; |
|
|
|
|
|
|
|
if (curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &byte_count) == CURLE_OK) |
|
|
|
|
|
|
|
pool->cgminer_pool_stats.bytes_received += byte_count; |
|
|
|
|
|
|
|
|
|
|
|
sprintf(s, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": []}", swork_id++); |
|
|
|
sprintf(s, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": []}", swork_id++); |
|
|
|
|
|
|
|
|
|
|
|
if (!__stratum_send(pool, s, strlen(s))) { |
|
|
|
if (!__stratum_send(pool, s, strlen(s))) { |
|
|
|