mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
stratum: disable haproxy ip translation code by default
toggle it via the .conf or edit code to change overall defaults
This commit is contained in:
parent
569661a25c
commit
46996e3269
3 changed files with 22 additions and 5 deletions
|
@ -58,8 +58,20 @@ YAAMP_SOCKET *socket_initialize(int sock)
|
|||
|
||||
// yaamp_create_mutex(&s->mutex);
|
||||
// pthread_mutex_lock(&s->mutex);
|
||||
int res = 0;
|
||||
if (!g_handle_haproxy_ips) {
|
||||
struct sockaddr_in name;
|
||||
socklen_t len = sizeof(name);
|
||||
memset(&name, 0, len);
|
||||
|
||||
res = getpeername(s->sock, (struct sockaddr *)&name, &len);
|
||||
inet_ntop(AF_INET, &name.sin_addr, s->ip, 64);
|
||||
|
||||
res = getsockname(s->sock, (struct sockaddr *)&name, &len);
|
||||
s->port = ntohs(name.sin_port);
|
||||
} else {
|
||||
socket_real_ip(s);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -202,7 +214,6 @@ int socket_send(YAAMP_SOCKET *s, const char *format, ...)
|
|||
|
||||
// pthread_mutex_lock(&s->mutex);
|
||||
int res = socket_send_raw(s, buffer, strlen(buffer));
|
||||
|
||||
// pthread_mutex_unlock(&s->mutex);
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ bool g_stratum_segwit = false;
|
|||
|
||||
int g_limit_txs_per_block = 0;
|
||||
|
||||
bool g_handle_haproxy_ips = false;
|
||||
|
||||
bool g_debuglog_client;
|
||||
bool g_debuglog_hash;
|
||||
bool g_debuglog_socket;
|
||||
|
@ -245,7 +247,9 @@ int main(int argc, char **argv)
|
|||
g_stratum_max_ttf = iniparser_getint(ini, "STRATUM:max_ttf", 0x70000000);
|
||||
g_stratum_reconnect = iniparser_getint(ini, "STRATUM:reconnect", true);
|
||||
g_stratum_renting = iniparser_getint(ini, "STRATUM:renting", true);
|
||||
g_handle_haproxy_ips = iniparser_getint(ini, "STRATUM:haproxy_ips", g_handle_haproxy_ips);
|
||||
|
||||
g_max_shares = iniparser_getint(ini, "STRATUM:max_shares", g_max_shares);
|
||||
g_limit_txs_per_block = iniparser_getint(ini, "STRATUM:max_txs_per_block", 0);
|
||||
|
||||
g_debuglog_client = iniparser_getint(ini, "DEBUGLOG:client", false);
|
||||
|
|
|
@ -90,6 +90,8 @@ extern bool g_stratum_renting;
|
|||
extern bool g_stratum_segwit;
|
||||
extern int g_limit_txs_per_block;
|
||||
|
||||
extern bool g_handle_haproxy_ips;
|
||||
|
||||
extern bool g_debuglog_client;
|
||||
extern bool g_debuglog_hash;
|
||||
extern bool g_debuglog_socket;
|
||||
|
|
Loading…
Add table
Reference in a new issue