stratum: extra check on client thread exit

This commit is contained in:
Tanguy Pruvot 2016-07-03 10:11:38 +02:00
parent 64ec96df41
commit 0c66f33c22
2 changed files with 8 additions and 11 deletions

View file

@ -530,8 +530,11 @@ void *client_thread(void *p)
#ifdef CLIENT_DEBUGLOG_
debuglog("client terminate\n");
#endif
if(!client || client->deleted) {
pthread_exit(NULL);
}
if(client->sock->total_read == 0)
else if(client->sock->total_read == 0)
clientlog(client, "no data");
if(g_list_client.Find(client))
@ -552,8 +555,3 @@ void *client_thread(void *p)
pthread_exit(NULL);
}

View file

@ -79,8 +79,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 = 5;
timeout.tv_usec = 0;
YAAMP_JOB_TEMPLATE *templ = job->templ;
@ -101,9 +101,8 @@ void job_broadcast(YAAMP_JOB *job)
client_add_job_history(client, job->id);
client_adjust_difficulty(client);
if (setsockopt (client->sock->sock, SOL_SOCKET, SO_SNDTIMEO, (void *)&timeout, sizeof(timeout)) < 0)
debuglog("setsockopt failed\n");
setsockopt(client->sock->sock, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout));
if (socket_send_raw(client->sock, buffer, strlen(buffer)) == -1) {
int err = errno;