mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
stratum: reduce socket timeouts to fight zombie miners
a normal socket send op is < 1ms unless something happened to this socket connection, generally a permanent disconnect...
This commit is contained in:
parent
90a100462d
commit
bbaf7b79c6
1 changed files with 3 additions and 3 deletions
|
@ -87,8 +87,8 @@ void job_broadcast(YAAMP_JOB *job)
|
|||
int s1 = current_timestamp_dms();
|
||||
int count = 0;
|
||||
struct timeval timeout;
|
||||
timeout.tv_sec = 5;
|
||||
timeout.tv_usec = 0;
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 100000; // max time to push to a socket (very fast)
|
||||
|
||||
YAAMP_JOB_TEMPLATE *templ = job->templ;
|
||||
|
||||
|
@ -115,10 +115,10 @@ void job_broadcast(YAAMP_JOB *job)
|
|||
if (socket_send_raw(client->sock, buffer, strlen(buffer)) == -1) {
|
||||
int err = errno;
|
||||
client->broadcast_timeouts++;
|
||||
clientlog(client, "unable to send job, sock err %d (%d times)", err, client->broadcast_timeouts);
|
||||
// too much timeouts, disconnect him
|
||||
if (client->broadcast_timeouts >= 3) {
|
||||
shutdown(client->sock->sock, SHUT_RDWR);
|
||||
clientlog(client, "unable to send job, sock err %d (%d times)", err, client->broadcast_timeouts);
|
||||
if(client->workerid && !client->reconnecting) {
|
||||
// CommonLock(&g_db_mutex);
|
||||
db_clear_worker(g_db, client);
|
||||
|
|
Loading…
Add table
Reference in a new issue