mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
stratum: debuglog on/off without code recompile
+ drop log CFLAGS comments in Makefile and old defines comments
This commit is contained in:
parent
010fd14493
commit
8c85b95220
10 changed files with 135 additions and 119 deletions
|
@ -8,12 +8,6 @@ SQLFLAGS= `mysql_config --cflags --libs`
|
||||||
# if you use the auto exchange feature...
|
# if you use the auto exchange feature...
|
||||||
CFLAGS += -DNO_EXCHANGE
|
CFLAGS += -DNO_EXCHANGE
|
||||||
|
|
||||||
#CFLAGS += -DHASH_DEBUGLOG_
|
|
||||||
#CFLAGS += -DRPC_DEBUGLOG_
|
|
||||||
#CFLAGS += -DREMOTE_DEBUGLOG_
|
|
||||||
#CFLAGS += -DSOCKET_DEBUGLOG_
|
|
||||||
#CFLAGS += -DCLIENT_DEBUGLOG_
|
|
||||||
|
|
||||||
#CFLAGS=-c -O2 -I /usr/include/mysql
|
#CFLAGS=-c -O2 -I /usr/include/mysql
|
||||||
LDFLAGS=-O2 `mysql_config --libs`
|
LDFLAGS=-O2 `mysql_config --libs`
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
|
|
||||||
#include "stratum.h"
|
#include "stratum.h"
|
||||||
|
|
||||||
//#define CLIENT_DEBUGLOG_
|
|
||||||
|
|
||||||
bool client_suggest_difficulty(YAAMP_CLIENT *client, json_value *json_params)
|
bool client_suggest_difficulty(YAAMP_CLIENT *client, json_value *json_params)
|
||||||
{
|
{
|
||||||
if(json_params->u.array.length>0)
|
if(json_params->u.array.length>0)
|
||||||
|
@ -88,9 +86,9 @@ bool client_subscribe(YAAMP_CLIENT *client, json_value *json_params)
|
||||||
memcpy(client->job_history, client1->job_history, sizeof(client->job_history));
|
memcpy(client->job_history, client1->job_history, sizeof(client->job_history));
|
||||||
client1->lock_count = 0;
|
client1->lock_count = 0;
|
||||||
|
|
||||||
#ifdef CLIENT_DEBUGLOG_
|
if (g_debuglog_client) {
|
||||||
debuglog("reconnecting client locked to %x\n", client->jobid_next);
|
debuglog("reconnecting client locked to %x\n", client->jobid_next);
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -106,9 +104,9 @@ bool client_subscribe(YAAMP_CLIENT *client, json_value *json_params)
|
||||||
memcpy(client->job_history, client1->job_history, sizeof(client->job_history));
|
memcpy(client->job_history, client1->job_history, sizeof(client->job_history));
|
||||||
client1->lock_count = 0;
|
client1->lock_count = 0;
|
||||||
|
|
||||||
#ifdef CLIENT_DEBUGLOG_
|
if (g_debuglog_client) {
|
||||||
debuglog("reconnecting2 client\n");
|
debuglog("reconnecting2 client\n");
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,9 +114,9 @@ bool client_subscribe(YAAMP_CLIENT *client, json_value *json_params)
|
||||||
strcpy(client->extranonce1_last, client->extranonce1);
|
strcpy(client->extranonce1_last, client->extranonce1);
|
||||||
client->extranonce2size_last = client->extranonce2size;
|
client->extranonce2size_last = client->extranonce2size;
|
||||||
|
|
||||||
#ifdef CLIENT_DEBUGLOG_
|
if (g_debuglog_client) {
|
||||||
debuglog("new client with nonce %s\n", client->extranonce1);
|
debuglog("new client with nonce %s\n", client->extranonce1);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
client_send_result(client, "[[[\"mining.set_difficulty\",\"%.3g\"],[\"mining.notify\",\"%s\"]],\"%s\",%d]",
|
client_send_result(client, "[[[\"mining.set_difficulty\",\"%.3g\"],[\"mining.notify\",\"%s\"]],\"%s\",%d]",
|
||||||
client->difficulty_actual, client->notify_id, client->extranonce1, client->extranonce2size);
|
client->difficulty_actual, client->notify_id, client->extranonce1, client->extranonce2size);
|
||||||
|
@ -236,9 +234,9 @@ bool client_authorize(YAAMP_CLIENT *client, json_value *json_params)
|
||||||
|
|
||||||
client_initialize_difficulty(client);
|
client_initialize_difficulty(client);
|
||||||
|
|
||||||
#ifdef CLIENT_DEBUGLOG_
|
if (g_debuglog_client) {
|
||||||
debuglog("new client %s, %s, %s\n", client->username, client->password, client->version);
|
debuglog("new client %s, %s, %s\n", client->username, client->password, client->version);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
if(!client->userid || !client->workerid)
|
if(!client->userid || !client->workerid)
|
||||||
{
|
{
|
||||||
|
@ -305,9 +303,9 @@ bool client_update_block(YAAMP_CLIENT *client, json_value *json_params)
|
||||||
|
|
||||||
const char* hash = json_params->u.array.values[2]->u.string.ptr;
|
const char* hash = json_params->u.array.values[2]->u.string.ptr;
|
||||||
|
|
||||||
#ifdef CLIENT_DEBUGLOG_
|
if (g_debuglog_client) {
|
||||||
debuglog("notify: new %s block %s\n", coind->symbol, hash);
|
debuglog("notify: new %s block %s\n", coind->symbol, hash);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
coind->newblock = true;
|
coind->newblock = true;
|
||||||
coind->notreportingcounter = 0;
|
coind->notreportingcounter = 0;
|
||||||
|
@ -578,9 +576,9 @@ void *client_thread(void *p)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CLIENT_DEBUGLOG_
|
if (g_debuglog_client) {
|
||||||
debuglog("client %s %d %s\n", method, client->id_int, client->id_str? client->id_str: "null");
|
debuglog("client %s %d %s\n", method, client->id_int, client->id_str? client->id_str: "null");
|
||||||
#endif
|
}
|
||||||
|
|
||||||
bool b = false;
|
bool b = false;
|
||||||
if(!strcmp(method, "mining.subscribe"))
|
if(!strcmp(method, "mining.subscribe"))
|
||||||
|
@ -634,9 +632,9 @@ void *client_thread(void *p)
|
||||||
|
|
||||||
// source_close(client->source);
|
// source_close(client->source);
|
||||||
|
|
||||||
#ifdef CLIENT_DEBUGLOG_
|
if (g_debuglog_client) {
|
||||||
debuglog("client terminate\n");
|
debuglog("client terminate\n");
|
||||||
#endif
|
}
|
||||||
if(!client || client->deleted) {
|
if(!client || client->deleted) {
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
uint64_t lyra2z_height = 0;
|
uint64_t lyra2z_height = 0;
|
||||||
|
|
||||||
//#define MERKLE_DEBUGLOG
|
//#define MERKLE_DEBUGLOG
|
||||||
//#define HASH_DEBUGLOG_
|
|
||||||
//#define DONTSUBMIT
|
//#define DONTSUBMIT
|
||||||
|
|
||||||
void build_submit_values(YAAMP_JOB_VALUES *submitvalues, YAAMP_JOB_TEMPLATE *templ,
|
void build_submit_values(YAAMP_JOB_VALUES *submitvalues, YAAMP_JOB_TEMPLATE *templ,
|
||||||
|
@ -285,20 +284,20 @@ static void client_do_submit(YAAMP_CLIENT *client, YAAMP_JOB *job, YAAMP_JOB_VAL
|
||||||
block_confirm(coind->id, submitvalues->hash_be);
|
block_confirm(coind->id, submitvalues->hash_be);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HASH_DEBUGLOG_
|
if (g_debuglog_hash) {
|
||||||
debuglog("--------------------------------------------------------------\n");
|
debuglog("--------------------------------------------------------------\n");
|
||||||
debuglog("hash1 %s\n", hash1);
|
debuglog("hash1 %s\n", hash1);
|
||||||
debuglog("hash2 %s\n", submitvalues->hash_be);
|
debuglog("hash2 %s\n", submitvalues->hash_be);
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
debuglog("*** REJECTED :( %s block %d %d txs\n", coind->name, templ->height, templ->txcount);
|
debuglog("*** REJECTED :( %s block %d %d txs\n", coind->name, templ->height, templ->txcount);
|
||||||
rejectlog("REJECTED %s block %d\n", coind->symbol, templ->height);
|
rejectlog("REJECTED %s block %d\n", coind->symbol, templ->height);
|
||||||
#ifdef HASH_DEBUGLOG_
|
if (g_debuglog_hash) {
|
||||||
//debuglog("block %s\n", block_hex);
|
//debuglog("block %s\n", block_hex);
|
||||||
debuglog("--------------------------------------------------------------\n");
|
debuglog("--------------------------------------------------------------\n");
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,9 +323,9 @@ void client_submit_error(YAAMP_CLIENT *client, YAAMP_JOB *job, int id, const cha
|
||||||
share_add(client, job, false, extranonce2, ntime, nonce, 0, id);
|
share_add(client, job, false, extranonce2, ntime, nonce, 0, id);
|
||||||
|
|
||||||
client->submit_bad++;
|
client->submit_bad++;
|
||||||
#ifdef HASH_DEBUGLOG_
|
if (g_debuglog_hash) {
|
||||||
dump_submit_debug(message, client, job, extranonce2, ntime, nonce);
|
dump_submit_debug(message, client, job, extranonce2, ntime, nonce);
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object_unlock(job);
|
object_unlock(job);
|
||||||
|
@ -377,9 +376,9 @@ bool client_submit(YAAMP_CLIENT *client, json_value *json_params)
|
||||||
if (json_params->u.array.length == 6)
|
if (json_params->u.array.length == 6)
|
||||||
strncpy(vote, json_params->u.array.values[5]->u.string.ptr, 7);
|
strncpy(vote, json_params->u.array.values[5]->u.string.ptr, 7);
|
||||||
|
|
||||||
#ifdef HASH_DEBUGLOG_
|
if (g_debuglog_hash) {
|
||||||
debuglog("submit %s (uid %d) %d, %s, %s, %s\n", client->sock->ip, client->userid, jobid, extranonce2, ntime, nonce);
|
debuglog("submit %s (uid %d) %d, %s, %s, %s\n", client->sock->ip, client->userid, jobid, extranonce2, ntime, nonce);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
string_lower(extranonce2);
|
string_lower(extranonce2);
|
||||||
string_lower(ntime);
|
string_lower(ntime);
|
||||||
|
@ -480,11 +479,11 @@ bool client_submit(YAAMP_CLIENT *client, json_value *json_params)
|
||||||
// minimum hash diff begins with 0000, for all...
|
// minimum hash diff begins with 0000, for all...
|
||||||
uint8_t pfx = submitvalues.hash_bin[30] | submitvalues.hash_bin[31];
|
uint8_t pfx = submitvalues.hash_bin[30] | submitvalues.hash_bin[31];
|
||||||
if(pfx) {
|
if(pfx) {
|
||||||
#ifdef HASH_DEBUGLOG_
|
if (g_debuglog_hash) {
|
||||||
debuglog("Possible %s error, hash starts with %02x%02x%02x%02x\n", g_current_algo->name,
|
debuglog("Possible %s error, hash starts with %02x%02x%02x%02x\n", g_current_algo->name,
|
||||||
(int) submitvalues.hash_bin[31], (int) submitvalues.hash_bin[30],
|
(int) submitvalues.hash_bin[31], (int) submitvalues.hash_bin[30],
|
||||||
(int) submitvalues.hash_bin[29], (int) submitvalues.hash_bin[28]);
|
(int) submitvalues.hash_bin[29], (int) submitvalues.hash_bin[28]);
|
||||||
#endif
|
}
|
||||||
client_submit_error(client, job, 25, "Invalid share", extranonce2, ntime, nonce);
|
client_submit_error(client, job, 25, "Invalid share", extranonce2, ntime, nonce);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -494,11 +493,11 @@ bool client_submit(YAAMP_CLIENT *client, json_value *json_params)
|
||||||
uint64_t coin_target = decode_compact(templ->nbits);
|
uint64_t coin_target = decode_compact(templ->nbits);
|
||||||
if (templ->nbits && !coin_target) coin_target = 0xFFFF000000000000ULL;
|
if (templ->nbits && !coin_target) coin_target = 0xFFFF000000000000ULL;
|
||||||
|
|
||||||
#ifdef HASH_DEBUGLOG_
|
if (g_debuglog_hash) {
|
||||||
debuglog("%016llx actual\n", hash_int);
|
debuglog("%016llx actual\n", hash_int);
|
||||||
debuglog("%016llx target\n", user_target);
|
debuglog("%016llx target\n", user_target);
|
||||||
debuglog("%016llx coin\n", coin_target);
|
debuglog("%016llx coin\n", coin_target);
|
||||||
#endif
|
}
|
||||||
if(hash_int > user_target && hash_int > coin_target)
|
if(hash_int > user_target && hash_int > coin_target)
|
||||||
{
|
{
|
||||||
client_submit_error(client, job, 26, "Low difficulty share", extranonce2, ntime, nonce);
|
client_submit_error(client, job, 26, "Low difficulty share", extranonce2, ntime, nonce);
|
||||||
|
@ -524,12 +523,12 @@ bool client_submit(YAAMP_CLIENT *client, json_value *json_params)
|
||||||
// share_diff = share_diff / g_current_algo->diff_multiplier;
|
// share_diff = share_diff / g_current_algo->diff_multiplier;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
#ifndef HASH_DEBUGLOG_
|
if (g_debuglog_hash) {
|
||||||
// only log a few...
|
// only log a few...
|
||||||
if (share_diff > (client->difficulty_actual * 16))
|
if (share_diff > (client->difficulty_actual * 16))
|
||||||
debuglog("submit %s (uid %d) %d, %s, %s, %s, %.3f/%.3f\n", client->sock->ip, client->userid,
|
debuglog("submit %s (uid %d) %d, %s, %s, %s, %.3f/%.3f\n", client->sock->ip, client->userid,
|
||||||
jobid, extranonce2, ntime, nonce, share_diff, client->difficulty_actual);
|
jobid, extranonce2, ntime, nonce, share_diff, client->difficulty_actual);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
share_add(client, job, true, extranonce2, ntime, nonce, share_diff, 0);
|
share_add(client, job, true, extranonce2, ntime, nonce, share_diff, 0);
|
||||||
object_unlock(job);
|
object_unlock(job);
|
||||||
|
|
|
@ -14,3 +14,11 @@ algo = skein
|
||||||
difficulty = 0.1
|
difficulty = 0.1
|
||||||
max_ttf = 200000000000000
|
max_ttf = 200000000000000
|
||||||
|
|
||||||
|
[DEBUGLOG]
|
||||||
|
client = 0
|
||||||
|
hash = 0
|
||||||
|
socket = 0
|
||||||
|
rpc = 0
|
||||||
|
list = 0
|
||||||
|
remote = 0
|
||||||
|
|
||||||
|
|
|
@ -5,21 +5,21 @@
|
||||||
|
|
||||||
void CommonLock(pthread_mutex_t *mutex)
|
void CommonLock(pthread_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
#ifdef _LIST_DEBUG_
|
if (g_debuglog_list) {
|
||||||
int i=0;
|
int i=0;
|
||||||
for(; i<10; i++)
|
for(; i<10; i++)
|
||||||
{
|
{
|
||||||
int res = pthread_mutex_trylock(mutex);
|
int res = pthread_mutex_trylock(mutex);
|
||||||
if(res == 0) break;
|
if(res == 0) break;
|
||||||
|
|
||||||
usleep(100*YAAMP_MS);
|
usleep(100*YAAMP_MS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i == 10)
|
||||||
|
debuglog("failed mutex2 %x <<----------------\n", mutex);
|
||||||
|
} else {
|
||||||
|
pthread_mutex_lock(mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i == 10)
|
|
||||||
debuglog("failed mutex2 %x <<----------------\n", mutex);
|
|
||||||
#else
|
|
||||||
pthread_mutex_lock(mutex);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonUnlock(pthread_mutex_t *mutex)
|
void CommonUnlock(pthread_mutex_t *mutex)
|
||||||
|
@ -43,21 +43,21 @@ CommonList::~CommonList()
|
||||||
|
|
||||||
void CommonList::Enter()
|
void CommonList::Enter()
|
||||||
{
|
{
|
||||||
#ifdef _LIST_DEBUG_
|
if (g_debuglog_list) {
|
||||||
int i=0;
|
int i=0;
|
||||||
for(; i<10; i++)
|
for(; i<10; i++)
|
||||||
{
|
{
|
||||||
int res = pthread_mutex_trylock(&mutex);
|
int res = pthread_mutex_trylock(&mutex);
|
||||||
if(res == 0) break;
|
if(res == 0) break;
|
||||||
|
|
||||||
usleep(100*YAAMP_MS);
|
usleep(100*YAAMP_MS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i == 10)
|
||||||
|
debuglog("failed mutex1 %x <<----------------\n", &mutex);
|
||||||
|
} else {
|
||||||
|
pthread_mutex_lock(&mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i == 10)
|
|
||||||
debuglog("failed mutex1 %x <<----------------\n", &mutex);
|
|
||||||
#else
|
|
||||||
pthread_mutex_lock(&mutex);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonList::Leave()
|
void CommonList::Leave()
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
|
|
||||||
#include "stratum.h"
|
#include "stratum.h"
|
||||||
|
|
||||||
//#define REMOTE_DEBUGLOG_
|
|
||||||
|
|
||||||
bool remote_can_mine(YAAMP_REMOTE *remote)
|
bool remote_can_mine(YAAMP_REMOTE *remote)
|
||||||
{
|
{
|
||||||
if(!remote) return false;
|
if(!remote) return false;
|
||||||
|
@ -40,9 +38,9 @@ bool remote_connected(YAAMP_REMOTE *remote)
|
||||||
|
|
||||||
void remote_close(YAAMP_REMOTE *remote)
|
void remote_close(YAAMP_REMOTE *remote)
|
||||||
{
|
{
|
||||||
#ifdef REMOTE_DEBUGLOG_
|
if (g_debuglog_remote) {
|
||||||
debuglog("remote_close JOB%d\n", remote->id);
|
debuglog("remote_close JOB%d\n", remote->id);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
remote->difficulty_actual = 0;
|
remote->difficulty_actual = 0;
|
||||||
|
|
||||||
|
@ -65,11 +63,11 @@ bool remote_connect(YAAMP_REMOTE *remote)
|
||||||
if(remote_connected(remote))
|
if(remote_connected(remote))
|
||||||
remote_close(remote);
|
remote_close(remote);
|
||||||
|
|
||||||
#ifdef REMOTE_DEBUGLOG_
|
if (g_debuglog_remote) {
|
||||||
debuglog("connecting to %s:%d JOB%d\n", remote->host, remote->port, remote->id);
|
debuglog("connecting to %s:%d JOB%d\n", remote->host, remote->port, remote->id);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
int sock = socket(AF_INET, SOCK_STREAM, 0);
|
int sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
if(sock <= 0) return false;
|
if(sock <= 0) return false;
|
||||||
|
|
||||||
struct hostent *ent = gethostbyname(remote->host);
|
struct hostent *ent = gethostbyname(remote->host);
|
||||||
|
@ -85,9 +83,9 @@ bool remote_connect(YAAMP_REMOTE *remote)
|
||||||
int res = connect(sock, (struct sockaddr*)&serv, sizeof(serv));
|
int res = connect(sock, (struct sockaddr*)&serv, sizeof(serv));
|
||||||
if(res < 0)
|
if(res < 0)
|
||||||
{
|
{
|
||||||
#ifdef REMOTE_DEBUGLOG_
|
if (g_debuglog_remote) {
|
||||||
debuglog("cant connect to %s:%d JOB%d\n", remote->host, remote->port, remote->id);
|
debuglog("cant connect to %s:%d JOB%d\n", remote->host, remote->port, remote->id);
|
||||||
#endif
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,9 @@ bool rpc_connect(YAAMP_RPC *rpc)
|
||||||
rpc->id = 0;
|
rpc->id = 0;
|
||||||
rpc->bufpos = 0;
|
rpc->bufpos = 0;
|
||||||
|
|
||||||
#ifdef RPC_DEBUGLOG_
|
if (g_debuglog_rpc) {
|
||||||
debuglog("connected to %s:%d\n", rpc->host, rpc->port);
|
debuglog("connected to %s:%d\n", rpc->host, rpc->port);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -52,9 +52,9 @@ void rpc_close(YAAMP_RPC *rpc)
|
||||||
close(rpc->sock);
|
close(rpc->sock);
|
||||||
rpc->sock = 0;
|
rpc->sock = 0;
|
||||||
|
|
||||||
#ifdef RPC_DEBUGLOG_
|
if (g_debuglog_rpc) {
|
||||||
debuglog("disconnected from %s:%d\n", rpc->host, rpc->port);
|
debuglog("disconnected from %s:%d\n", rpc->host, rpc->port);
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////
|
||||||
|
@ -66,9 +66,9 @@ int rpc_send_raw(YAAMP_RPC *rpc, const char *buffer, int bytes)
|
||||||
int res = send(rpc->sock, buffer, bytes, MSG_NOSIGNAL);
|
int res = send(rpc->sock, buffer, bytes, MSG_NOSIGNAL);
|
||||||
if(res <= 0) return res;
|
if(res <= 0) return res;
|
||||||
|
|
||||||
#ifdef RPC_DEBUGLOG_
|
if (g_debuglog_rpc) {
|
||||||
debuglog("sending >%s<\n", buffer);
|
debuglog("sending >%s<\n", buffer);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -148,9 +148,9 @@ char *rpc_do_call(YAAMP_RPC *rpc, char const *data)
|
||||||
while(!g_exiting)
|
while(!g_exiting)
|
||||||
{
|
{
|
||||||
int bytes = recv(rpc->sock, buffer+bufpos, YAAMP_SMALLBUFSIZE-bufpos-1, 0);
|
int bytes = recv(rpc->sock, buffer+bufpos, YAAMP_SMALLBUFSIZE-bufpos-1, 0);
|
||||||
#ifdef RPC_DEBUGLOG_
|
if (g_debuglog_rpc) {
|
||||||
debuglog("got %s\n", buffer+bufpos);
|
debuglog("got %s\n", buffer+bufpos);
|
||||||
#endif
|
}
|
||||||
if(bytes <= 0)
|
if(bytes <= 0)
|
||||||
{
|
{
|
||||||
debuglog("ERROR: recv1, %d, %d, %s, %s\n", bytes, errno, data, buffer);
|
debuglog("ERROR: recv1, %d, %d, %s, %s\n", bytes, errno, data, buffer);
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
|
|
||||||
#include "stratum.h"
|
#include "stratum.h"
|
||||||
|
|
||||||
//#define SOCKET_DEBUGLOG_
|
|
||||||
|
|
||||||
bool socket_connected(YAAMP_SOCKET *s)
|
bool socket_connected(YAAMP_SOCKET *s)
|
||||||
{
|
{
|
||||||
return s->sock > 0;
|
return s->sock > 0;
|
||||||
|
@ -68,9 +66,9 @@ YAAMP_SOCKET *socket_initialize(int sock)
|
||||||
|
|
||||||
void socket_close(YAAMP_SOCKET *s)
|
void socket_close(YAAMP_SOCKET *s)
|
||||||
{
|
{
|
||||||
#ifdef SOCKET_DEBUGLOG_
|
if (g_debuglog_socket) {
|
||||||
debuglog("socket_close\n");
|
debuglog("socket_close\n");
|
||||||
#endif
|
}
|
||||||
|
|
||||||
if(!s) return;
|
if(!s) return;
|
||||||
if(s->sock) close(s->sock);
|
if(s->sock) close(s->sock);
|
||||||
|
@ -174,9 +172,9 @@ json_value *socket_nextjson(YAAMP_SOCKET *s, YAAMP_CLIENT *client)
|
||||||
|
|
||||||
int socket_send_raw(YAAMP_SOCKET *s, const char *buffer, int size)
|
int socket_send_raw(YAAMP_SOCKET *s, const char *buffer, int size)
|
||||||
{
|
{
|
||||||
#ifdef SOCKET_DEBUGLOG_
|
if (g_debuglog_socket) {
|
||||||
debuglog("socket send: %s", buffer);
|
debuglog("socket send: %s", buffer);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
int res = send(s->sock, buffer, size, MSG_NOSIGNAL);
|
int res = send(s->sock, buffer, size, MSG_NOSIGNAL);
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -39,6 +39,13 @@ bool g_stratum_segwit = false;
|
||||||
|
|
||||||
int g_limit_txs_per_block = 0;
|
int g_limit_txs_per_block = 0;
|
||||||
|
|
||||||
|
bool g_debuglog_client;
|
||||||
|
bool g_debuglog_hash;
|
||||||
|
bool g_debuglog_socket;
|
||||||
|
bool g_debuglog_rpc;
|
||||||
|
bool g_debuglog_list;
|
||||||
|
bool g_debuglog_remote;
|
||||||
|
|
||||||
bool g_autoexchange = true;
|
bool g_autoexchange = true;
|
||||||
|
|
||||||
uint64_t g_max_shares = 0;
|
uint64_t g_max_shares = 0;
|
||||||
|
@ -241,6 +248,13 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
g_limit_txs_per_block = iniparser_getint(ini, "STRATUM:max_txs_per_block", 0);
|
g_limit_txs_per_block = iniparser_getint(ini, "STRATUM:max_txs_per_block", 0);
|
||||||
|
|
||||||
|
g_debuglog_client = iniparser_getint(ini, "DEBUGLOG:client", false);
|
||||||
|
g_debuglog_hash = iniparser_getint(ini, "DEBUGLOG:hash", false);
|
||||||
|
g_debuglog_socket = iniparser_getint(ini, "DEBUGLOG:socket", false);
|
||||||
|
g_debuglog_rpc = iniparser_getint(ini, "DEBUGLOG:rpc", false);
|
||||||
|
g_debuglog_list = iniparser_getint(ini, "DEBUGLOG:list", false);
|
||||||
|
g_debuglog_remote = iniparser_getint(ini, "DEBUGLOG:remote", false);
|
||||||
|
|
||||||
iniparser_freedict(ini);
|
iniparser_freedict(ini);
|
||||||
|
|
||||||
g_current_algo = stratum_find_algo(g_stratum_algo);
|
g_current_algo = stratum_find_algo(g_stratum_algo);
|
||||||
|
|
|
@ -90,6 +90,13 @@ extern bool g_stratum_renting;
|
||||||
extern bool g_stratum_segwit;
|
extern bool g_stratum_segwit;
|
||||||
extern int g_limit_txs_per_block;
|
extern int g_limit_txs_per_block;
|
||||||
|
|
||||||
|
extern bool g_debuglog_client;
|
||||||
|
extern bool g_debuglog_hash;
|
||||||
|
extern bool g_debuglog_socket;
|
||||||
|
extern bool g_debuglog_rpc;
|
||||||
|
extern bool g_debuglog_list;
|
||||||
|
extern bool g_debuglog_remote;
|
||||||
|
|
||||||
extern uint64_t g_max_shares;
|
extern uint64_t g_max_shares;
|
||||||
extern uint64_t g_shares_counter;
|
extern uint64_t g_shares_counter;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue