From f8f4d216ff3cd5eac37d7c8cf19bad517450247b Mon Sep 17 00:00:00 2001 From: john30 Date: Sun, 1 Dec 2019 09:34:37 +0100 Subject: [PATCH 1/9] fix for locking during update notification/handling --- src/ebusd/mainloop.cpp | 2 ++ src/ebusd/mqtthandler.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ebusd/mainloop.cpp b/src/ebusd/mainloop.cpp index 6d41e67e..844bea53 100644 --- a/src/ebusd/mainloop.cpp +++ b/src/ebusd/mainloop.cpp @@ -359,12 +359,14 @@ void MainLoop::run() { time(&now); if (!dataSinks.empty()) { messages.clear(); + m_messages->lock(); m_messages->findAll("", "", "*", false, true, true, true, true, true, sinkSince, now, false, &messages); for (const auto message : messages) { for (const auto dataSink : dataSinks) { dataSink->notifyUpdate(message); } } + m_messages->unlock(); sinkSince = now; } if (netMessage == nullptr) { diff --git a/src/ebusd/mqtthandler.cpp b/src/ebusd/mqtthandler.cpp index 1ded7a24..78df67af 100644 --- a/src/ebusd/mqtthandler.cpp +++ b/src/ebusd/mqtthandler.cpp @@ -747,8 +747,8 @@ void MqttHandler::run() { } } if (!m_updatedMessages.empty()) { + m_messages->lock(); if (m_connected) { - m_messages->lock(); for (auto it = m_updatedMessages.begin(); it != m_updatedMessages.end(); ) { const vector* messages = m_messages->getByKey(it->first); if (messages) { @@ -764,11 +764,11 @@ void MqttHandler::run() { } it = m_updatedMessages.erase(it); } - m_messages->unlock(); time(&lastUpdates); } else { m_updatedMessages.clear(); } + m_messages->unlock(); } if ((!m_connected && !Wait(5)) || (needsWait && !Wait(1))) { break; From 7ad50984519d2ff5c2e363397fc43bc489e13f89 Mon Sep 17 00:00:00 2001 From: john30 Date: Sat, 14 Dec 2019 16:36:43 +0100 Subject: [PATCH 2/9] added some basic info to non-ebusd clients --- contrib/updatecheck/index.php | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/contrib/updatecheck/index.php b/contrib/updatecheck/index.php index 7fa4dc7a..9a0d92c3 100644 --- a/contrib/updatecheck/index.php +++ b/contrib/updatecheck/index.php @@ -9,12 +9,35 @@ if (substr($agent, 0, 5)==='ebusd') { exit; } readVersions(); +$ref = @file_get_contents('ebusd-configuration/.git/refs/heads/master'); ?> - ebusd update check service + ebusd update check webservice -

latest ebusd version:

last update:

+git revision: ".substr($ref, 0, 7).'

'; + } +?> +

latest ebusd version:

+

config files: +$str\n"; + } else { + echo "
$str\n"; + } + }; + array_walk($versions, $func); +?> +

From 177568c537219bf1986bb7ff75a16f09756cea48 Mon Sep 17 00:00:00 2001 From: john30 Date: Sun, 29 Dec 2019 14:45:04 +0100 Subject: [PATCH 3/9] sharpen net device check keepalive options --- src/lib/ebus/device.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib/ebus/device.cpp b/src/lib/ebus/device.cpp index bfc85469..0cd071bd 100755 --- a/src/lib/ebus/device.cpp +++ b/src/lib/ebus/device.cpp @@ -299,6 +299,12 @@ result_t NetworkDevice::open() { ret = setsockopt(m_fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&value), sizeof(value)); value = 1; setsockopt(m_fd, SOL_SOCKET, SO_KEEPALIVE, reinterpret_cast(&value), sizeof(value)); + value = 3; // send keepalive after 3 seconds of silence + setsockopt(m_fd, IPPROTO_TCP, TCP_KEEPIDLE, reinterpret_cast(&value), sizeof(value)); + value = 2; // send keepalive in interval of 2 seconds + setsockopt(m_fd, IPPROTO_TCP, TCP_KEEPINTVL, reinterpret_cast(&value), sizeof(value)); + value = 2; // drop connection after 2 failed keep alive sends + setsockopt(m_fd, IPPROTO_TCP, TCP_KEEPCNT, reinterpret_cast(&value), sizeof(value)); } if (ret >= 0) { ret = connect(m_fd, (struct sockaddr*)&m_address, sizeof(m_address)); @@ -312,13 +318,18 @@ result_t NetworkDevice::open() { } int cnt; symbol_t buf[MTU]; - while (ioctl(m_fd, FIONREAD, &cnt) >= 0 && cnt > 1) { + int ioerr; + while ((ioerr=ioctl(m_fd, FIONREAD, &cnt)) >= 0 && cnt > 1) { // skip buffered input ssize_t read = ::read(m_fd, &buf, MTU); if (read <= 0) { break; } } + if (ioerr < 0) { + close(); + return RESULT_ERR_GENERIC_IO; + } if (m_bufSize == 0) { m_bufSize = MAX_LEN+1; m_buffer = reinterpret_cast(malloc(m_bufSize)); From 2eb6f5f5745dbda04d44bb2032662f6dff43bc7c Mon Sep 17 00:00:00 2001 From: john30 Date: Sat, 11 Jan 2020 08:41:13 +0100 Subject: [PATCH 4/9] fix duplicate /global entry (fixes #327) --- src/ebusd/mainloop.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ebusd/mainloop.cpp b/src/ebusd/mainloop.cpp index 844bea53..b7599854 100644 --- a/src/ebusd/mainloop.cpp +++ b/src/ebusd/mainloop.cpp @@ -2117,7 +2117,7 @@ result_t MainLoop::executeGet(const vector& args, bool* connected, ostri << ",\n \"maxsymbolrate\": " << m_busHandler->getMaxSymbolRate(); if (m_busHandler->getMinArbitrationDelay() >= 0) { *ostream << ",\n \"minarbitrationmicros\": " << m_busHandler->getMinArbitrationDelay() - << ",\n \"minarbitrationmicros\": " << m_busHandler->getMaxArbitrationDelay(); + << ",\n \"maxarbitrationmicros\": " << m_busHandler->getMaxArbitrationDelay(); } if (m_busHandler->getMinSymbolLatency() >= 0) { *ostream << ",\n \"minsymbollatency\": " << m_busHandler->getMinSymbolLatency() From 1834b59e8b558d461481e03a5780e6c5040bcd6b Mon Sep 17 00:00:00 2001 From: john30 Date: Sat, 11 Jan 2020 08:58:08 +0100 Subject: [PATCH 5/9] fix extra send retry (fixes #328) --- src/ebusd/bushandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100755 => 100644 src/ebusd/bushandler.cpp diff --git a/src/ebusd/bushandler.cpp b/src/ebusd/bushandler.cpp old mode 100755 new mode 100644 index 0b0ac176..230829da --- a/src/ebusd/bushandler.cpp +++ b/src/ebusd/bushandler.cpp @@ -328,7 +328,7 @@ result_t BusHandler::sendAndWait(const MasterSymbolString& master, SlaveSymbolSt ActiveBusRequest request(master, slave); logInfo(lf_bus, "send message: %s", master.getStr().c_str()); - for (int sendRetries = m_failedSendRetries + 1; sendRetries >= 0; sendRetries--) { + for (int sendRetries = m_failedSendRetries + 1; sendRetries > 0; sendRetries--) { m_nextRequests.push(&request); bool success = m_finishedRequests.remove(&request, true); result = success ? request.m_result : RESULT_ERR_TIMEOUT; @@ -339,7 +339,7 @@ result_t BusHandler::sendAndWait(const MasterSymbolString& master, SlaveSymbolSt logError(lf_bus, "send to %2.2x: %s, give up", master[1], getResultCode(result)); break; } - logError(lf_bus, "send to %2.2x: %s%s", master[1], getResultCode(result), sendRetries > 0 ? ", retry" : ""); + logError(lf_bus, "send to %2.2x: %s%s", master[1], getResultCode(result), sendRetries > 1 ? ", retry" : ""); request.m_busLostRetries = 0; } return result; From 3b569a01e128342bda40a2c34f494d86b0dd2739 Mon Sep 17 00:00:00 2001 From: john30 Date: Sat, 11 Jan 2020 12:39:23 +0100 Subject: [PATCH 6/9] fix for bad string.c_str() usage on temporary strings (seems to be problematic starting with gcc>=6.3.0, fixes #325 and #326) --- src/ebusd/mainloop.cpp | 5 +++-- src/lib/ebus/data.cpp | 7 ++++--- src/lib/ebus/datatype.cpp | 9 +++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/ebusd/mainloop.cpp b/src/ebusd/mainloop.cpp index b7599854..a63edff8 100644 --- a/src/ebusd/mainloop.cpp +++ b/src/ebusd/mainloop.cpp @@ -463,11 +463,12 @@ void MainLoop::notifyDeviceData(symbol_t symbol, bool received) { m_logRawLastSymbol = symbol; } if (symbol == SYN && m_logRawBuffer.tellp() > 0) { // flush + const string bufStr = m_logRawBuffer.str(); + const char* str = bufStr.c_str(); if (m_logRawFile) { - const char* str = m_logRawBuffer.str().c_str(); m_logRawFile->write((const unsigned char*)str, strlen(str), received, false); } else { - logNotice(lf_bus, m_logRawBuffer.str().c_str()); + logNotice(lf_bus, str); } m_logRawBuffer.str(""); } diff --git a/src/lib/ebus/data.cpp b/src/lib/ebus/data.cpp index d86e882c..57ada08b 100644 --- a/src/lib/ebus/data.cpp +++ b/src/lib/ebus/data.cpp @@ -775,17 +775,18 @@ result_t ValueListDataField::readSymbols(const SymbolString& input, size_t offse result_t ValueListDataField::writeSymbols(size_t offset, istringstream* input, SymbolString* output, size_t* usedLength) const { const NumberDataType* numType = reinterpret_cast(m_dataType); - if (isIgnored() || input->str() == nullptr_VALUE) { + const string inputStr = input->str(); + if (isIgnored() || inputStr == nullptr_VALUE) { // replacement value return numType->writeRawValue(numType->getReplacement(), offset, m_length, output, usedLength); } - const char* str = input->str().c_str(); for (map::const_iterator it = m_values.begin(); it != m_values.end(); ++it) { - if (it->second.compare(str) == 0) { + if (it->second == inputStr) { return numType->writeRawValue(it->first, offset, m_length, output, usedLength); } } + const char* str = inputStr.c_str(); char* strEnd = nullptr; // fall back to raw value in input unsigned int value; value = (unsigned int)strtoul(str, &strEnd, 10); diff --git a/src/lib/ebus/datatype.cpp b/src/lib/ebus/datatype.cpp index 2f2d24ec..27159903 100755 --- a/src/lib/ebus/datatype.cpp +++ b/src/lib/ebus/datatype.cpp @@ -805,12 +805,13 @@ result_t NumberDataType::writeSymbols(size_t offset, size_t length, istringstrea SymbolString* output, size_t* usedLength) const { unsigned int value; - if (!hasFlag(REQ) && (isIgnored() || input->str() == nullptr_VALUE)) { + const string inputStr = input->str(); + if (!hasFlag(REQ) && (isIgnored() || inputStr == nullptr_VALUE)) { value = m_replacement; // replacement value - } else if (input->str().empty()) { + } else if (inputStr.empty()) { return RESULT_ERR_EOF; // input too short } else if (hasFlag(EXP)) { // IEEE 754 binary32 - const char* str = input->str().c_str(); + const char* str = inputStr.c_str(); char* strEnd = nullptr; double dvalue = strtod(str, &strEnd); if (strEnd == nullptr || strEnd == str || *strEnd != 0) { @@ -849,7 +850,7 @@ result_t NumberDataType::writeSymbols(size_t offset, size_t length, istringstrea } #endif } else { - const char* str = input->str().c_str(); + const char* str = inputStr.c_str(); char* strEnd = nullptr; if (m_divisor == 1) { if (hasFlag(SIG)) { From f92a047c092f0e706eef08864ab29b0f6e391ece Mon Sep 17 00:00:00 2001 From: john30 Date: Sat, 11 Jan 2020 12:41:21 +0100 Subject: [PATCH 7/9] better constant name --- src/lib/ebus/contrib/tem.cpp | 4 ++-- src/lib/ebus/data.cpp | 4 ++-- src/lib/ebus/datatype.cpp | 20 ++++++++++---------- src/lib/ebus/datatype.h | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/lib/ebus/contrib/tem.cpp b/src/lib/ebus/contrib/tem.cpp index 09c36502..e568c19b 100755 --- a/src/lib/ebus/contrib/tem.cpp +++ b/src/lib/ebus/contrib/tem.cpp @@ -66,7 +66,7 @@ result_t TemParamDataType::readSymbols(size_t offset, size_t length, const Symbo if (outputFormat & OF_JSON) { *output << "null"; } else { - *output << nullptr_VALUE; + *output << NULL_VALUE; } return RESULT_OK; } @@ -94,7 +94,7 @@ result_t TemParamDataType::writeSymbols(const size_t offset, const size_t length unsigned int value; unsigned int grp, num; - if (input->str() == nullptr_VALUE) { + if (input->str() == NULL_VALUE) { value = m_replacement; // replacement value } else { string token; diff --git a/src/lib/ebus/data.cpp b/src/lib/ebus/data.cpp index 57ada08b..cdbd100e 100644 --- a/src/lib/ebus/data.cpp +++ b/src/lib/ebus/data.cpp @@ -752,7 +752,7 @@ result_t ValueListDataField::readSymbols(const SymbolString& input, size_t offse if (outputFormat & OF_JSON) { *output << "null"; } else if (value == m_dataType->getReplacement()) { - *output << nullptr_VALUE; + *output << NULL_VALUE; } } else if (outputFormat & OF_NUMERIC) { *output << setw(0) << dec << value; @@ -776,7 +776,7 @@ result_t ValueListDataField::writeSymbols(size_t offset, istringstream* input, SymbolString* output, size_t* usedLength) const { const NumberDataType* numType = reinterpret_cast(m_dataType); const string inputStr = input->str(); - if (isIgnored() || inputStr == nullptr_VALUE) { + if (isIgnored() || inputStr == NULL_VALUE) { // replacement value return numType->writeRawValue(numType->getReplacement(), offset, m_length, output, usedLength); } diff --git a/src/lib/ebus/datatype.cpp b/src/lib/ebus/datatype.cpp index 27159903..7d533b7b 100755 --- a/src/lib/ebus/datatype.cpp +++ b/src/lib/ebus/datatype.cpp @@ -243,13 +243,13 @@ result_t DateTimeDataType::readSymbols(size_t offset, size_t length, const Symbo case 2: // date only if (!hasFlag(REQ) && symbol == m_replacement) { if (i + 1 != length) { - *output << nullptr_VALUE << "."; + *output << NULL_VALUE << "."; break; } else if (last == m_replacement) { if (length == 2) { // number of days since 01.01.1900 - *output << nullptr_VALUE << "."; + *output << NULL_VALUE << "."; } - *output << nullptr_VALUE; + *output << NULL_VALUE; break; } } @@ -282,13 +282,13 @@ result_t DateTimeDataType::readSymbols(size_t offset, size_t length, const Symbo case 1: // time only if (!hasFlag(REQ) && symbol == m_replacement) { if (length == 1) { // truncated time - *output << nullptr_VALUE << ":" << nullptr_VALUE; + *output << NULL_VALUE << ":" << NULL_VALUE; break; } if (i > 0) { *output << ":"; } - *output << nullptr_VALUE; + *output << NULL_VALUE; break; } if (hasFlag(SPE)) { // minutes since midnight @@ -378,7 +378,7 @@ result_t DateTimeDataType::writeSymbols(size_t offset, size_t length, istringstr if (input->eof() || !getline(*input, token, '.')) { return RESULT_ERR_EOF; // incomplete } - if (!hasFlag(REQ) && token == nullptr_VALUE) { + if (!hasFlag(REQ) && token == NULL_VALUE) { value = m_replacement; break; } @@ -431,7 +431,7 @@ result_t DateTimeDataType::writeSymbols(size_t offset, size_t length, istringstr if (input->eof() || !getline(*input, token, LENGTH_SEPARATOR)) { return RESULT_ERR_EOF; // incomplete } - if (!hasFlag(REQ) && token == nullptr_VALUE) { + if (!hasFlag(REQ) && token == NULL_VALUE) { value = m_replacement; if (length == 1) { // truncated time if (i == 0) { @@ -654,7 +654,7 @@ result_t NumberDataType::readSymbols(size_t offset, size_t length, const SymbolS if (outputFormat & OF_JSON) { *output << "null"; } else { - *output << nullptr_VALUE; + *output << NULL_VALUE; } return RESULT_OK; } @@ -700,7 +700,7 @@ result_t NumberDataType::readSymbols(size_t offset, size_t length, const SymbolS if (outputFormat & OF_JSON) { *output << "null"; } else { - *output << nullptr_VALUE; + *output << NULL_VALUE; } return RESULT_OK; } @@ -806,7 +806,7 @@ result_t NumberDataType::writeSymbols(size_t offset, size_t length, istringstrea unsigned int value; const string inputStr = input->str(); - if (!hasFlag(REQ) && (isIgnored() || inputStr == nullptr_VALUE)) { + if (!hasFlag(REQ) && (isIgnored() || inputStr == NULL_VALUE)) { value = m_replacement; // replacement value } else if (inputStr.empty()) { return RESULT_ERR_EOF; // input too short diff --git a/src/lib/ebus/datatype.h b/src/lib/ebus/datatype.h index 0133ab29..7231d004 100755 --- a/src/lib/ebus/datatype.h +++ b/src/lib/ebus/datatype.h @@ -58,7 +58,7 @@ using std::ostringstream; #define LENGTH_SEPARATOR ':' /** the replacement string for undefined values (in UI and CSV). */ -#define nullptr_VALUE "-" +#define NULL_VALUE "-" /** the separator character used between fields (in UI only). */ #define UI_FIELD_SEPARATOR ';' @@ -134,7 +134,7 @@ enum PartType { /** bit flag for @a DataType: fixed width formatting. */ #define FIX 0x20 -/** bit flag for @a DataType: value may not be nullptr. */ +/** bit flag for @a DataType: value may not be NULL. */ #define REQ 0x40 /** bit flag for @a DataType: binary representation is hex converted to decimal and interpreted as 2 digits From 7b8ceb7db5972f203c6b3479758b16668f3a9c09 Mon Sep 17 00:00:00 2001 From: john30 Date: Sat, 11 Jan 2020 12:51:37 +0100 Subject: [PATCH 8/9] support cygwin build --- src/lib/ebus/device.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib/ebus/device.cpp b/src/lib/ebus/device.cpp index 0cd071bd..78ec839d 100755 --- a/src/lib/ebus/device.cpp +++ b/src/lib/ebus/device.cpp @@ -280,6 +280,17 @@ void SerialDevice::checkDevice() { } } +#ifdef __CYGWIN__ + #ifndef TCP_KEEPCNT + #define TCP_KEEPCNT 8 + #endif + #ifndef TCP_KEEPINTVL + #define TCP_KEEPINTVL 150 + #endif + #ifndef TCP_KEEPIDLE + #define TCP_KEEPIDLE 14400 + #endif +#endif result_t NetworkDevice::open() { if (m_fd != -1) { From fb3296040267a677797d76e766b73e56d7197f50 Mon Sep 17 00:00:00 2001 From: john30 Date: Sat, 25 Jan 2020 15:22:30 +0100 Subject: [PATCH 9/9] add option to reduce dump flush buffer size to 1 --- src/ebusd/main.cpp | 6 ++++++ src/ebusd/main.h | 1 + src/ebusd/mainloop.cpp | 2 +- src/lib/utils/rotatefile.cpp | 2 +- src/lib/utils/rotatefile.h | 8 ++++++-- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/ebusd/main.cpp b/src/ebusd/main.cpp index 54803402..a1924f35 100644 --- a/src/ebusd/main.cpp +++ b/src/ebusd/main.cpp @@ -123,6 +123,7 @@ static struct options opt = { false, // dump "/tmp/" PACKAGE "_dump.bin", // dumpFile 100, // dumpSize + false, // dumpFlush }; /** the @a MessageMap instance, or nullptr. */ @@ -174,6 +175,7 @@ static const char argpdoc[] = #define O_RAWSIZ (O_RAWFIL+1) #define O_DMPFIL (O_RAWSIZ+1) #define O_DMPSIZ (O_DMPFIL+1) +#define O_DMPFLU (O_DMPSIZ+1) /** the definition of the known program arguments. */ static const struct argp_option argpoptions[] = { @@ -242,6 +244,7 @@ static const struct argp_option argpoptions[] = { {"dump", 'D', nullptr, 0, "Enable binary dump of received bytes", 0 }, {"dumpfile", O_DMPFIL, "FILE", 0, "Dump received bytes to FILE [/tmp/" PACKAGE "_dump.bin]", 0 }, {"dumpsize", O_DMPSIZ, "SIZE", 0, "Make dump file no larger than SIZE kB [100]", 0 }, + {"dumpflush", O_DMPFLU, nullptr, 0, "Flush each byte", 0 }, {nullptr, 0, nullptr, 0, nullptr, 0 }, }; @@ -581,6 +584,9 @@ error_t parse_opt(int key, char *arg, struct argp_state *state) { return EINVAL; } break; + case O_DMPFLU: // --dumpflush + opt->dumpFlush = true; + break; case ARGP_KEY_ARG: if (opt->injectMessages || (opt->checkConfig && opt->scanConfig)) { diff --git a/src/ebusd/main.h b/src/ebusd/main.h index 97717af0..e2721365 100644 --- a/src/ebusd/main.h +++ b/src/ebusd/main.h @@ -85,6 +85,7 @@ struct options { bool dump; //!< binary dump received bytes const char* dumpFile; //!< name of dump file [/tmp/ebusd_dump.bin] unsigned int dumpSize; //!< maximum size of dump file in kB [100] + bool dumpFlush; //!< flush each byte }; /** diff --git a/src/ebusd/mainloop.cpp b/src/ebusd/mainloop.cpp index a63edff8..a295e41f 100644 --- a/src/ebusd/mainloop.cpp +++ b/src/ebusd/mainloop.cpp @@ -111,7 +111,7 @@ MainLoop::MainLoop(const struct options& opt, Device *device, MessageMap* messag } m_device->setListener(this); if (opt.dumpFile[0]) { - m_dumpFile = new RotateFile(opt.dumpFile, opt.dumpSize); + m_dumpFile = new RotateFile(opt.dumpFile, opt.dumpSize, false, opt.dumpFlush ? 1 : 16); m_dumpFile->setEnabled(opt.dump); } else { m_dumpFile = nullptr; diff --git a/src/lib/utils/rotatefile.cpp b/src/lib/utils/rotatefile.cpp index 062c9953..8cf4cc68 100755 --- a/src/lib/utils/rotatefile.cpp +++ b/src/lib/utils/rotatefile.cpp @@ -82,7 +82,7 @@ void RotateFile::write(const unsigned char* value, const size_t size, const bool fwrite(value, (streamsize)size, 1, m_stream); m_fileSize += size; m_flushSize += size; - if (m_flushSize > 16) { + if (m_flushSize >= m_flushBuffer) { fflush(m_stream); m_flushSize = 0; } diff --git a/src/lib/utils/rotatefile.h b/src/lib/utils/rotatefile.h index e184d574..5e75aef2 100755 --- a/src/lib/utils/rotatefile.h +++ b/src/lib/utils/rotatefile.h @@ -43,10 +43,11 @@ class RotateFile { * @param fileName the name of the file write to. * @param maxSize the maximum size of the file to write to. * @param textMode whether to write each byte with prefixed timestamp and direction as text. + * @param flushBuffer the size of the flush buffer. */ - RotateFile(const string fileName, const unsigned int maxSize, const bool textMode = false) + RotateFile(const string fileName, const unsigned int maxSize, const bool textMode = false, const unsigned int flushBuffer = 16) : m_enabled(false), m_fileName(fileName), m_maxSize(maxSize), m_textMode(textMode), m_stream(), m_fileSize(0), - m_flushSize(0) {} + m_flushSize(0), m_flushBuffer(flushBuffer) {} /** * Destructor. @@ -98,6 +99,9 @@ class RotateFile { /** the number of bytes written to @a m_file since the last flush. */ uint64_t m_flushSize; + + /** the size of the flush buffer. */ + const unsigned int m_flushBuffer; }; } // namespace ebusd