From 57479cef8c440f8c8d2e83ca5ea8b7ae03949e7b Mon Sep 17 00:00:00 2001 From: XMRig Date: Fri, 31 Aug 2018 18:01:15 +0300 Subject: [PATCH] Sync changes. --- src/common/api/HttpRequest.cpp | 2 +- src/common/config/CommonConfig.cpp | 4 ++++ src/common/config/CommonConfig.h | 2 ++ src/common/crypto/keccak.h | 6 +++--- src/common/interfaces/IConfig.h | 17 ++++++++++++++--- src/common/interfaces/IControllerListener.h | 6 +++--- src/common/utils/timestamp.h | 8 ++++---- 7 files changed, 31 insertions(+), 14 deletions(-) diff --git a/src/common/api/HttpRequest.cpp b/src/common/api/HttpRequest.cpp index 01245dfc..6898a385 100644 --- a/src/common/api/HttpRequest.cpp +++ b/src/common/api/HttpRequest.cpp @@ -147,7 +147,7 @@ int xmrig::HttpRequest::end(int status, MHD_Response *rsp) MHD_add_response_header(rsp, "Content-Type", "application/json"); MHD_add_response_header(rsp, "Access-Control-Allow-Origin", "*"); MHD_add_response_header(rsp, "Access-Control-Allow-Methods", "GET, PUT"); - MHD_add_response_header(rsp, "Access-Control-Allow-Headers", "Authorization"); + MHD_add_response_header(rsp, "Access-Control-Allow-Headers", "Authorization, Content-Type"); const int ret = MHD_queue_response(m_connection, status, rsp); MHD_destroy_response(rsp); diff --git a/src/common/config/CommonConfig.cpp b/src/common/config/CommonConfig.cpp index 7e43b39d..ca901757 100644 --- a/src/common/config/CommonConfig.cpp +++ b/src/common/config/CommonConfig.cpp @@ -251,6 +251,10 @@ bool xmrig::CommonConfig::parseString(int key, const char *arg) m_apiWorkerId = arg; break; + case ApiIdKey: /* --api-id */ + m_apiId = arg; + break; + case UserAgentKey: /* --user-agent */ m_userAgent = arg; break; diff --git a/src/common/config/CommonConfig.h b/src/common/config/CommonConfig.h index ffebb6b2..fa27ea6a 100644 --- a/src/common/config/CommonConfig.h +++ b/src/common/config/CommonConfig.h @@ -49,6 +49,7 @@ public: inline bool isColors() const { return m_colors; } inline bool isDryRun() const { return m_dryRun; } inline bool isSyslog() const { return m_syslog; } + inline const char *apiId() const { return m_apiId.data(); } inline const char *apiToken() const { return m_apiToken.data(); } inline const char *apiWorkerId() const { return m_apiWorkerId.data(); } inline const char *logFile() const { return m_logFile.data(); } @@ -97,6 +98,7 @@ protected: State m_state; std::vector m_activePools; std::vector m_pools; + xmrig::c_str m_apiId; xmrig::c_str m_apiToken; xmrig::c_str m_apiWorkerId; xmrig::c_str m_fileName; diff --git a/src/common/crypto/keccak.h b/src/common/crypto/keccak.h index da8d6c52..6121044a 100644 --- a/src/common/crypto/keccak.h +++ b/src/common/crypto/keccak.h @@ -23,8 +23,8 @@ */ -#ifndef KECCAK_H_ -#define KECCAK_H_ +#ifndef XMRIG_KECCAK_H +#define XMRIG_KECCAK_H #include #include @@ -52,4 +52,4 @@ void keccakf(uint64_t st[25], int norounds); } /* namespace xmrig */ -#endif /* KECCAK_H_ */ +#endif /* XMRIG_KECCAK_H */ diff --git a/src/common/interfaces/IConfig.h b/src/common/interfaces/IConfig.h index 4b3f8788..fb622e37 100644 --- a/src/common/interfaces/IConfig.h +++ b/src/common/interfaces/IConfig.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef __ICONFIG_H__ -#define __ICONFIG_H__ +#ifndef XMRIG_ICONFIG_H +#define XMRIG_ICONFIG_H #include "common/crypto/Algorithm.h" @@ -42,6 +42,7 @@ public: ApiPort = 4000, ApiRestrictedKey = 4004, ApiWorkerIdKey = 4002, + ApiIdKey = 4005, BackgroundKey = 'B', ColorKey = 1002, ConfigKey = 'c', @@ -97,6 +98,16 @@ public: PoolCoinKey = 'C', ReuseTimeoutKey = 1106, WorkersKey = 1103, + WorkersAdvKey = 1107, + + // xmrig nvidia + CudaMaxThreadsKey = 1200, + CudaBFactorKey = 1201, + CudaBSleepKey = 1202, + CudaDevicesKey = 1203, + CudaLaunchKey = 1204, + CudaAffinityKey = 1205, + CudaMaxUsageKey = 1206, }; virtual ~IConfig() {} @@ -118,4 +129,4 @@ public: } /* namespace xmrig */ -#endif // __ICONFIG_H__ +#endif // XMRIG_ICONFIG_H diff --git a/src/common/interfaces/IControllerListener.h b/src/common/interfaces/IControllerListener.h index d6077138..35249bcd 100644 --- a/src/common/interfaces/IControllerListener.h +++ b/src/common/interfaces/IControllerListener.h @@ -21,8 +21,8 @@ * along with this program. If not, see . */ -#ifndef __ICONTROLLERLISTENER_H__ -#define __ICONTROLLERLISTENER_H__ +#ifndef XMRIG_ICONTROLLERLISTENER_H +#define XMRIG_ICONTROLLERLISTENER_H namespace xmrig { @@ -43,4 +43,4 @@ public: } /* namespace xmrig */ -#endif // __ICONTROLLERLISTENER_H__ +#endif // XMRIG_ICONTROLLERLISTENER_H diff --git a/src/common/utils/timestamp.h b/src/common/utils/timestamp.h index b4404b2e..6b6a8ab2 100644 --- a/src/common/utils/timestamp.h +++ b/src/common/utils/timestamp.h @@ -21,8 +21,8 @@ * along with this program. If not, see . */ -#ifndef __TIMESTAMP_H__ -#define __TIMESTAMP_H__ +#ifndef XMRIG_TIMESTAMP_H +#define XMRIG_TIMESTAMP_H #include @@ -31,7 +31,7 @@ namespace xmrig { -int64_t currentMSecsSinceEpoch() +static inline int64_t currentMSecsSinceEpoch() { using namespace std::chrono; if (high_resolution_clock::is_steady) { @@ -44,4 +44,4 @@ int64_t currentMSecsSinceEpoch() } /* namespace xmrig */ -#endif /* __TIMESTAMP_H__ */ +#endif /* XMRIG_TIMESTAMP_H */