Fixed compile issues
This commit is contained in:
parent
b6fc43b8a4
commit
4f606644fe
4 changed files with 10 additions and 17 deletions
|
@ -261,12 +261,10 @@ include_directories(src)
|
||||||
include_directories(src/3rdparty)
|
include_directories(src/3rdparty)
|
||||||
include_directories(${UV_INCLUDE_DIR})
|
include_directories(${UV_INCLUDE_DIR})
|
||||||
|
|
||||||
add_subdirectory(src/3rdparty/jansson)
|
|
||||||
|
|
||||||
add_executable(xmrig ${HEADERS} ${SOURCES} ${HEADERS_COMMON} ${SOURCES_COMMON} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES})
|
add_executable(xmrig ${HEADERS} ${SOURCES} ${HEADERS_COMMON} ${SOURCES_COMMON} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES})
|
||||||
target_link_libraries(xmrig jansson ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})
|
target_link_libraries(xmrig ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})
|
||||||
|
|
||||||
if (WITH_CC_SERVER AND MHD_FOUND)
|
if (WITH_CC_SERVER AND MHD_FOUND)
|
||||||
add_executable(xmrigCC ${HEADERS_COMMON} ${SOURCES_COMMON} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CC_SERVER} ${CC_SERVER_SOURCES} ${SOURCES_SYSLOG})
|
add_executable(xmrigCC ${HEADERS_COMMON} ${SOURCES_COMMON} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CC_SERVER} ${CC_SERVER_SOURCES} ${SOURCES_SYSLOG})
|
||||||
target_link_libraries(xmrigCC jansson ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})
|
target_link_libraries(xmrigCC ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})
|
||||||
endif()
|
endif()
|
|
@ -134,7 +134,7 @@ void ClientStatus::setLastStatusUpdate(uint32_t lastStatusUpdate)
|
||||||
ClientStatus::lastStatusUpdate = lastStatusUpdate;
|
ClientStatus::lastStatusUpdate = lastStatusUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientStatus::parseFromJson(const json_t &json)
|
void ClientStatus::parseFromJson(const rapidjson::Document &doc)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,8 @@
|
||||||
#ifndef __CLIENTSTATUS_H__
|
#ifndef __CLIENTSTATUS_H__
|
||||||
#define __CLIENTSTATUS_H__
|
#define __CLIENTSTATUS_H__
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <3rdparty/jansson/jansson.h>
|
#include "rapidjson/document.h"
|
||||||
|
|
||||||
class ClientStatus
|
class ClientStatus
|
||||||
{
|
{
|
||||||
|
@ -66,7 +65,7 @@ public:
|
||||||
void setLastStatusUpdate(uint32_t lastStatusUpdate);
|
void setLastStatusUpdate(uint32_t lastStatusUpdate);
|
||||||
|
|
||||||
std::string toJson();
|
std::string toJson();
|
||||||
void parseFromJson(const json_t& json);
|
void parseFromJson(const rapidjson::Document &doc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string miner;
|
std::string miner;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <3rdparty/jansson/jansson.h>
|
#include <3rdparty/rapidjson/document.h>
|
||||||
#include "server/Service.h"
|
#include "server/Service.h"
|
||||||
#include "log/Log.h"
|
#include "log/Log.h"
|
||||||
|
|
||||||
|
@ -84,15 +84,11 @@ unsigned Service::post(const char *url, const std::string &data, std::string &re
|
||||||
|
|
||||||
LOG_INFO("POST(%s, %s)", url, data.c_str());
|
LOG_INFO("POST(%s, %s)", url, data.c_str());
|
||||||
|
|
||||||
json_error_t err;
|
rapidjson::Document document;
|
||||||
json_t *val = json_loads(data.c_str(), 0, &err);
|
if (!document.Parse(data.c_str()).HasParseError()) {
|
||||||
|
LOG_ERR("Status from miner: %s", document['miner'].GetString());
|
||||||
if (val) {
|
|
||||||
const char *miner = json_string_value(json_object_get(val, "miner"));
|
|
||||||
const char *currentPool = json_string_value(json_object_get(val, "currentPool"));
|
|
||||||
LOG_INFO("received = miner: %s on pool: %s", miner, currentPool);
|
|
||||||
} else {
|
} else {
|
||||||
LOG_ERR("BAD POST REQUEST: %s", err.text);
|
LOG_ERR("Parse Error Occured: %d", document.GetParseError());
|
||||||
return MHD_HTTP_BAD_REQUEST;
|
return MHD_HTTP_BAD_REQUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue