Add "autosave" config option.

This commit is contained in:
XMRig 2018-09-27 19:07:04 +03:00
parent a63677e255
commit 143da8380e
8 changed files with 36 additions and 13 deletions

View file

@ -67,6 +67,7 @@ xmrig::CommonConfig::CommonConfig() :
m_adjusted(false),
m_apiIPv6(false),
m_apiRestricted(true),
m_autoSave(true),
m_background(false),
m_colors(true),
m_dryRun(false),
@ -217,7 +218,7 @@ bool xmrig::CommonConfig::save()
rapidjson::PrettyWriter<rapidjson::FileWriteStream> writer(os);
doc.Accept(writer);
fclose(fp);
fflush(fp);
uv_fs_close(uv_default_loop(), &req, fd, nullptr);
uv_fs_req_cleanup(&req);
@ -308,10 +309,14 @@ bool xmrig::CommonConfig::parseBoolean(int key, bool enable)
m_apiRestricted = enable;
break;
case IConfig::DryRunKey: /* --dry-run */
case DryRunKey: /* --dry-run */
m_dryRun = enable;
break;
case AutoSaveKey:
m_autoSave = enable;
break;
default:
break;
}

View file

@ -44,6 +44,7 @@ public:
inline bool isApiIPv6() const { return m_apiIPv6; }
inline bool isApiRestricted() const { return m_apiRestricted; }
inline bool isAutoSave() const { return m_autoSave; }
inline bool isBackground() const { return m_background; }
inline bool isColors() const { return m_colors; }
inline bool isDryRun() const { return m_dryRun; }
@ -88,6 +89,7 @@ protected:
bool m_adjusted;
bool m_apiIPv6;
bool m_apiRestricted;
bool m_autoSave;
bool m_background;
bool m_colors;
bool m_dryRun;

View file

@ -65,6 +65,7 @@ public:
WatchKey = 1105,
TlsKey = 1013,
FingerprintKey = 1014,
AutoSaveKey = 1016,
// xmrig common
CPUPriorityKey = 1021,