Permalink
Browse files

Do not allow EIT to prevent backend shutdown through last minute resc…

…hedules. Closes #3597

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
  • Loading branch information...
1 parent ce71c14 commit de0d29c8b6e3a1f9a0b07d82a07d9a2dd85a3973 Andrew M. Bishop committed with stuartm Jul 24, 2011
Showing with 14 additions and 9 deletions.
  1. +12 −8 mythtv/programs/mythbackend/scheduler.cpp
  2. +2 −1 mythtv/programs/mythbackend/scheduler.h
View
20 mythtv/programs/mythbackend/scheduler.cpp
@@ -1914,7 +1914,8 @@ void Scheduler::run(void)
if ((idleTimeoutSecs > 0) && (m_mainServer != NULL))
{
HandleIdleShutdown(blockShutdown, idleSince, prerollseconds,
- idleTimeoutSecs, idleWaitForRecordingTime);
+ idleTimeoutSecs, idleWaitForRecordingTime,
+ statuschanged);
}
}
@@ -2511,7 +2512,8 @@ void Scheduler::HandleTuning(RecordingInfo &ri, bool &statuschanged)
void Scheduler::HandleIdleShutdown(
bool &blockShutdown, QDateTime &idleSince,
- int prerollseconds, int idleTimeoutSecs, int idleWaitForRecordingTime)
+ int prerollseconds, int idleTimeoutSecs, int idleWaitForRecordingTime,
+ bool &statuschanged)
{
if ((idleTimeoutSecs <= 0) || (m_mainServer == NULL))
return;
@@ -2545,8 +2547,11 @@ void Scheduler::HandleIdleShutdown(
}
resetIdleTime_lock.unlock();
- if (!idleSince.isValid())
+ if (statuschanged || !idleSince.isValid())
{
+ if (!idleSince.isValid())
+ idleSince = curtime;
+
RecIter idleIter = reclist.begin();
for ( ; idleIter != reclist.end(); ++idleIter)
if ((*idleIter)->GetRecordingStatus() ==
@@ -2557,17 +2562,16 @@ void Scheduler::HandleIdleShutdown(
{
if (curtime.secsTo
((*idleIter)->GetRecordingStartTime()) -
- prerollseconds >
+ prerollseconds <
(idleWaitForRecordingTime * 60) +
idleTimeoutSecs)
{
- idleSince = curtime;
+ idleSince = QDateTime();
}
}
- else
- idleSince = curtime;
}
- else
+
+ if (idleSince.isValid())
{
// is the machine already idling the timeout time?
if (idleSince.addSecs(idleTimeoutSecs) < curtime)
View
3 mythtv/programs/mythbackend/scheduler.h
@@ -165,7 +165,8 @@ class Scheduler : public QThread
RecordingInfo &ri, RecStatusTypes recStatus, const QString &details);
void HandleIdleShutdown(
bool &blockShutdown, QDateTime &idleSince, int prerollseconds,
- int idleTimeoutSecs, int idleWaitForRecordingTime);
+ int idleTimeoutSecs, int idleWaitForRecordingTime,
+ bool &statuschanged);
MythDeque<int> reschedQueue;

0 comments on commit de0d29c

Please sign in to comment.