Skip to content

Commit

Permalink
ExternalStreamHandler: fix an inverted logic bug
Browse files Browse the repository at this point in the history
When checking for errors, it was treating warnings as errors.
  • Loading branch information
jpoet committed Nov 1, 2018
1 parent e8aebe2 commit 710fdf1
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions mythtv/libs/libmythtv/recorders/ExternalStreamHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,12 @@ void ExternalStreamHandler::run(void)
uint restart_cnt = 0;
MythTimer status_timer;

if (!m_IO)
{
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("%1 is not running.").arg(_device));
}

status_timer.start();

RunProlog();
Expand Down Expand Up @@ -638,7 +644,7 @@ void ExternalStreamHandler::run(void)
if (empty_cnt % 5000)
{
if (restart_cnt++)
std::this_thread::sleep_for(std::chrono::seconds(5));
std::this_thread::sleep_for(std::chrono::seconds(20));
if (!RestartStream())
_error = true;
xon = false;
Expand All @@ -662,7 +668,7 @@ void ExternalStreamHandler::run(void)
if (CheckForError())
{
if (restart_cnt++)
std::this_thread::sleep_for(std::chrono::seconds(5));
std::this_thread::sleep_for(std::chrono::seconds(20));
if (!RestartStream())
_error = true;
xon = false;
Expand Down Expand Up @@ -751,7 +757,12 @@ void ExternalStreamHandler::run(void)
buffer.remove(0, len - remainder);
}

if (m_IO->Error())
if (m_IO == nullptr)
{
LOG(VB_GENERAL, LOG_ERR, LOC + "I/O thread has disappeared!");
_error = true;
}
else if (m_IO->Error())
{
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("Fatal Error from External Recorder: %1")
Expand Down Expand Up @@ -1013,7 +1024,7 @@ bool ExternalStreamHandler::StartStreaming(void)
if (!ProcessCommand("StartStreaming", 1000, result, 10, 5))
{
LogLevel_t level = LOG_ERR;
if (!result.toLower().startsWith("warn"))
if (result.toLower().startsWith("warn"))
level = LOG_WARNING;
else
_error = true;
Expand Down Expand Up @@ -1074,7 +1085,7 @@ bool ExternalStreamHandler::StopStreaming(void)
if (!ProcessCommand("StopStreaming", 1000, result, 10, 5))
{
LogLevel_t level = LOG_ERR;
if (!result.toLower().startsWith("warn"))
if (result.toLower().startsWith("warn"))
level = LOG_WARNING;
else
_error = true;
Expand Down

0 comments on commit 710fdf1

Please sign in to comment.