Add quit command
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
diff --git a/api.c b/api.c
index f07989f..bea877d 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 62d7312..8430ccc 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