Merge branch 'master' into dev

This commit is contained in:
XMRig 2017-08-14 08:19:11 +03:00
commit 5ad1a48489
6 changed files with 23 additions and 8 deletions

View file

@ -1,3 +1,6 @@
# v2.2.1
- Fixed [terminal issues](https://github.com/xmrig/xmrig-proxy/issues/2#issuecomment-319914085) after exit on Linux and OS X.
# v2.2.0 # v2.2.0
- [#46](https://github.com/xmrig/xmrig/issues/46) Restored config file support. Now possible use multiple config files and combine with command line options also added support for default config. - [#46](https://github.com/xmrig/xmrig/issues/46) Restored config file support. Now possible use multiple config files and combine with command line options also added support for default config.
- Improved colors support on Windows, now used uv_tty, legacy code removed. - Improved colors support on Windows, now used uv_tty, legacy code removed.

View file

@ -59,6 +59,9 @@ App::App(int argc, char **argv) :
Cpu::init(); Cpu::init();
m_options = Options::parse(argc, argv); m_options = Options::parse(argc, argv);
if (!m_options) {
return;
}
Log::init(); Log::init();
@ -91,7 +94,7 @@ App::~App()
int App::exec() int App::exec()
{ {
if (!m_options->isReady()) { if (!m_options) {
return 0; return 0;
} }
@ -115,6 +118,7 @@ int App::exec()
const int r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); const int r = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
uv_loop_close(uv_default_loop()); uv_loop_close(uv_default_loop());
uv_tty_reset_mode();
free(m_network); free(m_network);
free(m_options); free(m_options);

View file

@ -31,8 +31,12 @@ Console::Console(IConsoleListener *listener)
{ {
m_tty.data = this; m_tty.data = this;
uv_tty_init(uv_default_loop(), &m_tty, 0, 1); uv_tty_init(uv_default_loop(), &m_tty, 0, 1);
uv_tty_set_mode(&m_tty, UV_TTY_MODE_RAW);
if (!uv_is_readable(reinterpret_cast<uv_stream_t*>(&m_tty))) {
return;
}
uv_tty_set_mode(&m_tty, UV_TTY_MODE_RAW);
uv_read_start(reinterpret_cast<uv_stream_t*>(&m_tty), Console::onAllocBuffer, Console::onRead); uv_read_start(reinterpret_cast<uv_stream_t*>(&m_tty), Console::onAllocBuffer, Console::onRead);
} }

View file

@ -181,11 +181,14 @@ static char *defaultConfigName()
Options *Options::parse(int argc, char **argv) Options *Options::parse(int argc, char **argv)
{ {
if (!m_self) { Options *options = new Options(argc, argv);
m_self = new Options(argc, argv); if (options->isReady()) {
m_self = options;
return m_self;
} }
return m_self; delete options;
return nullptr;
} }

View file

@ -57,7 +57,6 @@ public:
inline bool background() const { return m_background; } inline bool background() const { return m_background; }
inline bool colors() const { return m_colors; } inline bool colors() const { return m_colors; }
inline bool doubleHash() const { return m_doubleHash; } inline bool doubleHash() const { return m_doubleHash; }
inline bool isReady() const { return m_ready; }
inline bool syslog() const { return m_syslog; } inline bool syslog() const { return m_syslog; }
inline const char *logFile() const { return m_logFile; } inline const char *logFile() const { return m_logFile; }
inline const std::vector<Url*> &pools() const { return m_pools; } inline const std::vector<Url*> &pools() const { return m_pools; }
@ -76,6 +75,8 @@ private:
Options(int argc, char **argv); Options(int argc, char **argv);
~Options(); ~Options();
inline bool isReady() const { return m_ready; }
static Options *m_self; static Options *m_self;
bool parseArg(int key, const char *arg); bool parseArg(int key, const char *arg);

View file

@ -27,14 +27,14 @@
#define APP_ID "xmrig" #define APP_ID "xmrig"
#define APP_NAME "XMRig" #define APP_NAME "XMRig"
#define APP_DESC "Monero (XMR) CPU miner" #define APP_DESC "Monero (XMR) CPU miner"
#define APP_VERSION "2.2.0-dev" #define APP_VERSION "2.2.1"
#define APP_DOMAIN "xmrig.com" #define APP_DOMAIN "xmrig.com"
#define APP_SITE "www.xmrig.com" #define APP_SITE "www.xmrig.com"
#define APP_COPYRIGHT "Copyright (C) 2016-2017 xmrig.com" #define APP_COPYRIGHT "Copyright (C) 2016-2017 xmrig.com"
#define APP_VER_MAJOR 2 #define APP_VER_MAJOR 2
#define APP_VER_MINOR 2 #define APP_VER_MINOR 2
#define APP_VER_BUILD 0 #define APP_VER_BUILD 1
#define APP_VER_REV 0 #define APP_VER_REV 0
#ifdef _MSC_VER #ifdef _MSC_VER