Skip to content
Snippets Groups Projects
Commit 3ab11077 authored by Alejandro Domínguez's avatar Alejandro Domínguez
Browse files

Force flush at the end of line

parent 40d38e76
No related branches found
No related tags found
No related merge requests found
...@@ -113,14 +113,6 @@ R"===( ...@@ -113,14 +113,6 @@ R"===(
*/ */
"daemon_mode" : false, "daemon_mode" : false,
/*
* Buffered output control.
* When running the miner through a pipe, standard output is buffered. This means that the pipe won't read
* each output line immediately. This can cause delays when running in background.
* Set this option to true to flush stdout after each line, so it can be read immediately.
*/
"flush_stdout" : false,
/* /*
* Output file * Output file
* *
......
...@@ -52,7 +52,7 @@ using namespace rapidjson; ...@@ -52,7 +52,7 @@ using namespace rapidjson;
*/ */
enum configEnum { enum configEnum {
aPoolList, sCurrency, bTlsSecureAlgo, iCallTimeout, iNetRetry, iGiveUpLimit, iVerboseLevel, bPrintMotd, iAutohashTime, aPoolList, sCurrency, bTlsSecureAlgo, iCallTimeout, iNetRetry, iGiveUpLimit, iVerboseLevel, bPrintMotd, iAutohashTime,
bFlushStdout, bDaemonMode, sOutputFile, iHttpdPort, sHttpLogin, sHttpPass, bPreferIpv4, bAesOverride, sUseSlowMem bDaemonMode, sOutputFile, iHttpdPort, sHttpLogin, sHttpPass, bPreferIpv4, bAesOverride, sUseSlowMem
}; };
struct configVal { struct configVal {
...@@ -73,7 +73,6 @@ configVal oConfigValues[] = { ...@@ -73,7 +73,6 @@ configVal oConfigValues[] = {
{ iVerboseLevel, "verbose_level", kNumberType }, { iVerboseLevel, "verbose_level", kNumberType },
{ bPrintMotd, "print_motd", kTrueType }, { bPrintMotd, "print_motd", kTrueType },
{ iAutohashTime, "h_print_time", kNumberType }, { iAutohashTime, "h_print_time", kNumberType },
{ bFlushStdout, "flush_stdout", kTrueType},
{ bDaemonMode, "daemon_mode", kTrueType }, { bDaemonMode, "daemon_mode", kTrueType },
{ sOutputFile, "output_file", kStringType }, { sOutputFile, "output_file", kStringType },
{ iHttpdPort, "httpd_port", kNumberType }, { iHttpdPort, "httpd_port", kNumberType },
...@@ -607,16 +606,6 @@ bool jconf::parse_config(const char* sFilename, const char* sFilenamePools) ...@@ -607,16 +606,6 @@ bool jconf::parse_config(const char* sFilename, const char* sFilenamePools)
} }
#endif // _WIN32 #endif // _WIN32
if (prv->configValues[bFlushStdout]->IsBool())
{
bool bflush = prv->configValues[bFlushStdout]->GetBool();
printer::inst()->set_flush_stdout(bflush);
if (bflush)
{
printer::inst()->print_msg(L0, "Flush stdout forced.");
}
}
std::string ctmp = GetMiningCoin(); std::string ctmp = GetMiningCoin();
std::transform(ctmp.begin(), ctmp.end(), ctmp.begin(), ::tolower); std::transform(ctmp.begin(), ctmp.end(), ctmp.begin(), ::tolower);
......
...@@ -156,7 +156,6 @@ printer::printer() ...@@ -156,7 +156,6 @@ printer::printer()
{ {
verbose_level = LINF; verbose_level = LINF;
logfile = nullptr; logfile = nullptr;
b_flush_stdout = false;
} }
bool printer::open_logfile(const char* file) bool printer::open_logfile(const char* file)
...@@ -193,11 +192,7 @@ void printer::print_msg(verbosity verbose, const char* fmt, ...) ...@@ -193,11 +192,7 @@ void printer::print_msg(verbosity verbose, const char* fmt, ...)
std::unique_lock<std::mutex> lck(print_mutex); std::unique_lock<std::mutex> lck(print_mutex);
fputs(buf, stdout); fputs(buf, stdout);
fflush(stdout);
if (b_flush_stdout)
{
fflush(stdout);
}
if(logfile != nullptr) if(logfile != nullptr)
{ {
...@@ -210,11 +205,7 @@ void printer::print_str(const char* str) ...@@ -210,11 +205,7 @@ void printer::print_str(const char* str)
{ {
std::unique_lock<std::mutex> lck(print_mutex); std::unique_lock<std::mutex> lck(print_mutex);
fputs(str, stdout); fputs(str, stdout);
fflush(stdout);
if (b_flush_stdout)
{
fflush(stdout);
}
if(logfile != nullptr) if(logfile != nullptr)
{ {
...@@ -223,7 +214,7 @@ void printer::print_str(const char* str) ...@@ -223,7 +214,7 @@ void printer::print_str(const char* str)
} }
} }
//Do a press any key for the windows folk. *insert any key joke here* // Do a press any key for the windows folk. *insert any key joke here*
#ifdef _WIN32 #ifdef _WIN32
void win_exit(int code) void win_exit(int code)
{ {
......
...@@ -35,7 +35,6 @@ public: ...@@ -35,7 +35,6 @@ public:
}; };
inline void set_verbose_level(size_t level) { verbose_level = (verbosity)level; } inline void set_verbose_level(size_t level) { verbose_level = (verbosity)level; }
inline void set_flush_stdout(bool status) { b_flush_stdout = status; }
void print_msg(verbosity verbose, const char* fmt, ...); void print_msg(verbosity verbose, const char* fmt, ...);
void print_str(const char* str); void print_str(const char* str);
bool open_logfile(const char* file); bool open_logfile(const char* file);
...@@ -45,7 +44,6 @@ private: ...@@ -45,7 +44,6 @@ private:
std::mutex print_mutex; std::mutex print_mutex;
verbosity verbose_level; verbosity verbose_level;
bool b_flush_stdout;
FILE* logfile; FILE* logfile;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment