mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-25 14:04:25 +00:00
Shut down the api cleanly when the api thread is cancelled. This should allow the api socket to be closed successfully to next be reopened with app_restart.
This commit is contained in:
parent
127c4a5ff4
commit
9b5615d5f3
5
api.c
5
api.c
@ -2029,7 +2029,7 @@ static void send_result(SOCKETTYPE c, bool isjson)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tidyup()
|
static void tidyup(void *arg)
|
||||||
{
|
{
|
||||||
bye = 1;
|
bye = 1;
|
||||||
|
|
||||||
@ -2182,6 +2182,7 @@ void api(int api_thr_id)
|
|||||||
bool did;
|
bool did;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
pthread_cleanup_push(tidyup, NULL);
|
||||||
my_thr_id = api_thr_id;
|
my_thr_id = api_thr_id;
|
||||||
|
|
||||||
/* This should be done first to ensure curl has already called WSAStartup() in windows */
|
/* This should be done first to ensure curl has already called WSAStartup() in windows */
|
||||||
@ -2392,5 +2393,5 @@ void api(int api_thr_id)
|
|||||||
CLOSESOCKET(c);
|
CLOSESOCKET(c);
|
||||||
}
|
}
|
||||||
die:
|
die:
|
||||||
tidyup();
|
pthread_cleanup_pop(true);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user