From 1c0ca4c329c99caa75f438745b53a53f2978cd30 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Wed, 3 Jun 2020 23:02:23 +0200 Subject: [PATCH] some changes to take care of activity --- serviceinterface/ServiceInterfaceBuffer.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/serviceinterface/ServiceInterfaceBuffer.cpp b/serviceinterface/ServiceInterfaceBuffer.cpp index b0abb929..93de88b3 100644 --- a/serviceinterface/ServiceInterfaceBuffer.cpp +++ b/serviceinterface/ServiceInterfaceBuffer.cpp @@ -33,7 +33,7 @@ void ServiceInterfaceBuffer::putChars(char const* begin, char const* end) { #endif int ServiceInterfaceBuffer::overflow(int c) { - if(errStream) { + if(errStream and this->isActive) { if (c != Traits::eof()) { printChar(reinterpret_cast(&c), true); } @@ -53,17 +53,18 @@ int ServiceInterfaceBuffer::overflow(int c) { } int ServiceInterfaceBuffer::sync(void) { - if(errStream) { + if(not this->isActive or errStream) { + if(not errStream) { + setp(buf, buf + BUF_SIZE - 1); + } return 0; } - if (this->isActive) { - auto preamble = getPreamble(); - // Write logMessage and time - this->putChars(preamble.c_str(), preamble.c_str() + preamble.size()); - // Handle output - this->putChars(pbase(), pptr()); - } + auto preamble = getPreamble(); + // Write logMessage and time + this->putChars(preamble.c_str(), preamble.c_str() + preamble.size()); + // Handle output + this->putChars(pbase(), pptr()); // This tells that buffer is empty again setp(buf, buf + BUF_SIZE - 1); return 0;