Browse Source

Merge branch 'api-quit'

djm34
Noel Maersk 11 years ago
parent
commit
bfff79c3b0
  1. 2
      NEWS.md
  2. 21
      api.c
  3. 8
      doc/API

2
NEWS.md

@ -4,6 +4,8 @@ @@ -4,6 +4,8 @@
* API response to `version` has field `CGMiner` instead of `SGMiner`,
and an additional `Miner` field (by _luke-jr_).
* API response to `restart` and `quit` only contains a `status` section
and passes JSON validation (by _luke-jr_).
## Version 4.1.271 - 12th April 2014

21
api.c

@ -204,8 +204,6 @@ static const char ISJSON = '{'; @@ -204,8 +204,6 @@ static const char ISJSON = '{';
#define JSON_GPUS JSON1 _GPUS JSON2
#define JSON_NOTIFY JSON1 _NOTIFY JSON2
#define JSON_DEVDETAILS JSON1 _DEVDETAILS JSON2
#define JSON_BYE JSON1 _BYE JSON1
#define JSON_RESTART JSON1 _RESTART JSON1
#define JSON_CLOSE JSON3
#define JSON_MINESTATS JSON1 _MINESTATS JSON2
#define JSON_CHECK JSON1 _CHECK JSON2
@ -302,6 +300,8 @@ static const char *JSON_PARAMETER = "parameter"; @@ -302,6 +300,8 @@ static const char *JSON_PARAMETER = "parameter";
#define MSG_ZERSUM 96
#define MSG_ZERNOSUM 97
#define MSG_BYE 0x101
#define MSG_INVNEG 121
#define MSG_SETQUOTA 122
#define MSG_LOCKOK 123
@ -423,6 +423,7 @@ struct CODES { @@ -423,6 +423,7 @@ struct CODES {
{ SEVERITY_SUCC, MSG_ZERNOSUM, PARAM_STR, "Zeroed %s stats without summary" },
{ SEVERITY_SUCC, MSG_LOCKOK, PARAM_NONE, "Lock stats created" },
{ SEVERITY_WARN, MSG_LOCKDIS, PARAM_NONE, "Lock stats not enabled" },
{ SEVERITY_SUCC, MSG_BYE, PARAM_STR, "%s" },
{ SEVERITY_FAIL, 0, (enum code_parameters)0, NULL }
};
@ -545,12 +546,6 @@ static bool io_add(struct io_data *io_data, char *buf) @@ -545,12 +546,6 @@ static bool io_add(struct io_data *io_data, char *buf)
return true;
}
static bool io_put(struct io_data *io_data, char *buf)
{
io_reinit(io_data);
return io_add(io_data, buf);
}
static void io_close(struct io_data *io_data)
{
io_data->close = true;
@ -2576,10 +2571,7 @@ static void gpuvddc(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb @@ -2576,10 +2571,7 @@ static void gpuvddc(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb
void doquit(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson, __maybe_unused char group)
{
if (isjson)
io_put(io_data, JSON_START JSON_BYE);
else
io_put(io_data, _BYE);
message(io_data, MSG_BYE, 0, _BYE, isjson);
bye = true;
do_a_quit = true;
@ -2587,10 +2579,7 @@ void doquit(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __maybe_unused @@ -2587,10 +2579,7 @@ void doquit(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __maybe_unused
void dorestart(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson, __maybe_unused char group)
{
if (isjson)
io_put(io_data, JSON_START JSON_RESTART);
else
io_put(io_data, _RESTART);
message(io_data, MSG_BYE, 0, _RESTART, isjson);
bye = true;
do_a_restart = true;

8
doc/API

@ -277,8 +277,8 @@ The list of requests - a (*) means it requires privileged access - and replies: @@ -277,8 +277,8 @@ The list of requests - a (*) means it requires privileged access - and replies:
The filename is optional and will use the sgminer
default if not specified
quit (*) none There is no status section but just a single "BYE"
reply before sgminer quits
quit (*) none There is no reply section just the STATUS section
before BFGMiner quits
notify NOTIFY The last status and history count of each devices
problem
@ -328,8 +328,8 @@ The list of requests - a (*) means it requires privileged access - and replies: @@ -328,8 +328,8 @@ The list of requests - a (*) means it requires privileged access - and replies:
supported by the 'devs' command
e.g. DEVDETAILS=0,Name=GPU,ID=0,Driver=opencl,...|
restart (*) none There is no status section but just a single
"RESTART" reply before sgminer restarts
restart (*) none There is no reply section just the STATUS section
before BFGMiner restarts
stats STATS Each device or pool that has 1 or more getworks
with a list of stats regarding getwork times

Loading…
Cancel
Save