diff --git a/api.c b/api.c index f07989f2..bea877da 100644 --- a/api.c +++ b/api.c @@ -189,6 +189,13 @@ char *poolstatus(char *params) return buffer; } +char *doquit(char *params) +{ + bye = 1; + kill_work(); + return NULL; +} + struct CMDS { char *name; char *(*func)(char *); @@ -196,9 +203,10 @@ struct CMDS { { "apiversion", apiversion }, { "dev", devstatus }, { "pool", poolstatus }, + { "quit", doquit }, }; -#define CMDMAX 3 +#define CMDMAX 4 void send_result(int c, char *result) { @@ -211,7 +219,7 @@ void send_result(int c, char *result) n = write(c, result, strlen(result)+1); } -void api() +void api(void) { char buf[BUFSIZ]; const char *addr; diff --git a/miner.h b/miner.h index 62d73122..8430ccc5 100644 --- a/miner.h +++ b/miner.h @@ -394,7 +394,9 @@ struct work_restart { char padding[128 - sizeof(unsigned long)]; }; -extern void api(); +extern void kill_work(void); + +extern void api(void); #define MAX_GPUDEVICES 16