Browse Source

Sync changes.

pull/905/head
XMRig 6 years ago
parent
commit
9f6f599d78
  1. 4
      CMakeLists.txt
  2. 2
      cmake/OpenSSL.cmake
  3. 4
      src/App.cpp
  4. 3
      src/common/config/CommonConfig.cpp
  5. 5
      src/common/config/ConfigLoader.cpp
  6. 9
      src/common/config/ConfigLoader.h
  7. 6
      src/core/Controller.cpp
  8. 7
      src/core/Controller.h

4
CMakeLists.txt

@ -257,5 +257,5 @@ if (WITH_DEBUG_LOG)
add_definitions(/DAPP_DEBUG)
endif()
add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES})
target_link_libraries(${PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES})
target_link_libraries(${CMAKE_PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})

2
cmake/OpenSSL.cmake

@ -20,4 +20,6 @@ else()
set(TLS_SOURCES "")
set(OPENSSL_LIBRARIES "")
add_definitions(/DXMRIG_NO_TLS)
set(CMAKE_PROJECT_NAME "${CMAKE_PROJECT_NAME}-notls")
endif()

4
src/App.cpp

@ -87,6 +87,10 @@ App::~App()
int App::exec()
{
if (m_controller->isDone()) {
return 0;
}
if (!m_controller->isReady()) {
return 2;
}

3
src/common/config/CommonConfig.cpp

@ -174,8 +174,11 @@ void xmrig::CommonConfig::printVersions()
int length = snprintf(buf, sizeof buf, "CUDA/%d.%d ", cudaVersion / 1000, cudaVersion % 100);
# else
memset(buf, 0, 16);
# if !defined(XMRIG_NO_HTTPD) || !defined(XMRIG_NO_TLS)
int length = 0;
# endif
# endif
# if !defined(XMRIG_NO_TLS) && defined(OPENSSL_VERSION_TEXT)
{

5
src/common/config/ConfigLoader.cpp

@ -50,6 +50,7 @@
#include "rapidjson/filereadstream.h"
bool xmrig::ConfigLoader::m_done = false;
xmrig::ConfigWatcher *xmrig::ConfigLoader::m_watcher = nullptr;
xmrig::IConfigCreator *xmrig::ConfigLoader::m_creator = nullptr;
xmrig::IWatcherListener *xmrig::ConfigLoader::m_listener = nullptr;
@ -283,12 +284,16 @@ void xmrig::ConfigLoader::parseJSON(xmrig::IConfig *config, const struct option
void xmrig::ConfigLoader::showUsage()
{
m_done = true;
printf(usage);
}
void xmrig::ConfigLoader::showVersion()
{
m_done = true;
printf(APP_NAME " " APP_VERSION "\n built on " __DATE__
# if defined(__clang__)

9
src/common/config/ConfigLoader.h

@ -21,8 +21,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CONFIGLOADER_H__
#define __CONFIGLOADER_H__
#ifndef XMRIG_CONFIGLOADER_H
#define XMRIG_CONFIGLOADER_H
#include <stdint.h>
@ -53,6 +53,8 @@ public:
static IConfig *load(int argc, char **argv, IConfigCreator *creator, IWatcherListener *listener);
static void release();
static inline bool isDone() { return m_done; }
private:
static bool getJSON(const char *fileName, rapidjson::Document &doc);
static bool parseArg(IConfig *config, int key, const char *arg);
@ -60,6 +62,7 @@ private:
static void showUsage();
static void showVersion();
static bool m_done;
static ConfigWatcher *m_watcher;
static IConfigCreator *m_creator;
static IWatcherListener *m_listener;
@ -68,4 +71,4 @@ private:
} /* namespace xmrig */
#endif /* __CONFIGLOADER_H__ */
#endif /* XMRIG_CONFIGLOADER_H */

6
src/core/Controller.cpp

@ -78,6 +78,12 @@ xmrig::Controller::~Controller()
}
bool xmrig::Controller::isDone() const
{
return ConfigLoader::isDone();
}
bool xmrig::Controller::isReady() const
{
return d_ptr->config && d_ptr->network;

7
src/core/Controller.h

@ -21,8 +21,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CONTROLLER_H__
#define __CONTROLLER_H__
#ifndef XMRIG_CONTROLLER_H
#define XMRIG_CONTROLLER_H
#include "common/interfaces/IWatcherListener.h"
@ -46,6 +46,7 @@ public:
Controller();
~Controller();
bool isDone() const;
bool isReady() const;
Config *config() const;
int init(int argc, char **argv);
@ -61,4 +62,4 @@ private:
} /* namespace xmrig */
#endif /* __CONTROLLER_H__ */
#endif /* XMRIG_CONTROLLER_H */

Loading…
Cancel
Save