sgminer-dev / sgminer

Scrypt GPU miner
GNU General Public License v3.0
631 stars 825 forks source link

JSON Response to API Command "quit" Invalid JSON #197

Closed brcolow closed 10 years ago

brcolow commented 10 years ago

Hello,

I noticed that when working with the JSON-RPC API provided by SGMiner that when issuing the "quit" command, SGMiner responds via with the following JSON:

{ "BYE", "id":1 }

When I went to parse this string as JSON (as I do with all the API command replies), my JSON library threw up. Looking into this a bit more, this is invalid JSON (try putting the above string into http://jsonformatter.curiousconcept.com/ for example). We can easily fix this by changing the response to:

{ "Msg":"BYE", "id":1 }

or something similar.

Thanks, Michael Ennen

veox commented 10 years ago

Note: version has the same.

luke-jr commented 10 years ago

Thoughts on luke-jr/bfgminer#438 as a solution? (Note I did not see any problem with version...)

veox commented 10 years ago

My bad, version is fine (used api-example.c which doesn't format parse the output as JSON; api-example.py does, and fails on restart/quit).

https://github.com/luke-jr/bfgminer/pull/438 works fine. EDIT: will merge soon.

veox commented 10 years ago

Merged in https://github.com/sgminer-dev/sgminer/commit/bfff79c3b0c3122b8fa87b3b0db1634d56970225