Added delay in windows closse of xmrigDaemon when an error occurs

This commit is contained in:
BenDroid 2017-12-04 21:47:47 +01:00
parent de0183c284
commit b4586bf40e
2 changed files with 9 additions and 2 deletions

View file

@ -120,7 +120,7 @@ App::~App()
int App::start() int App::start()
{ {
if (!m_options) { if (!m_options) {
return 0; return EINVAL;
} }
uv_signal_start(&m_signal, App::onSignal, SIGHUP); uv_signal_start(&m_signal, App::onSignal, SIGHUP);
@ -131,7 +131,7 @@ int App::start()
if (!CryptoNight::init(m_options->algo(), m_options->algoVariant())) { if (!CryptoNight::init(m_options->algo(), m_options->algoVariant())) {
LOG_ERR("\"%s\" hash self-test failed.", m_options->algoName()); LOG_ERR("\"%s\" hash self-test failed.", m_options->algoName());
return 1; return EINVAL;
} }
Mem::allocate(m_options); Mem::allocate(m_options);

View file

@ -29,6 +29,8 @@
#define WIN32_LEAN_AND_MEAN /* avoid including junk */ #define WIN32_LEAN_AND_MEAN /* avoid including junk */
#include <windows.h> #include <windows.h>
#include <signal.h> #include <signal.h>
#include <chrono>
#include <thread>
#endif #endif
int main(int argc, char **argv) { int main(int argc, char **argv) {
@ -55,7 +57,12 @@ int main(int argc, char **argv) {
status = system(xmrigMinerPath.c_str()); status = system(xmrigMinerPath.c_str());
#ifdef WIN32 #ifdef WIN32
} while (status == EINTR); } while (status == EINTR);
if (status == EINVAL) {
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
}
#else #else
} while (WEXITSTATUS(status) == EINTR); } while (WEXITSTATUS(status) == EINTR);
#endif #endif
} }