diff --git a/mythtv/programs/mythbackend/encoderlink.cpp b/mythtv/programs/mythbackend/encoderlink.cpp
index c00ba77..788f3fc 100644
a
|
b
|
int EncoderLink::SetSignalMonitoringRate(int rate, int notifyFrontend) |
347 | 347 | |
348 | 348 | /** \brief Tell a slave to go to sleep |
349 | 349 | */ |
350 | | bool EncoderLink::GoToSleep(void) |
| 350 | int EncoderLink::GoToSleep(void) |
351 | 351 | { |
352 | 352 | if (IsLocal() || !sock) |
353 | 353 | return false; |
diff --git a/mythtv/programs/mythbackend/encoderlink.h b/mythtv/programs/mythbackend/encoderlink.h
index 8de94d9..422854d 100644
a
|
b
|
class EncoderLink |
64 | 64 | TVRec *GetTVRec(void) { return tv; } |
65 | 65 | |
66 | 66 | /// \brief Tell a slave backend to go to sleep |
67 | | bool GoToSleep(void); |
| 67 | int GoToSleep(void); |
68 | 68 | int LockTuner(void); |
69 | 69 | /// \brief Unlock the tuner. |
70 | 70 | /// \sa LockTuner(), IsTunerLocked() |
diff --git a/mythtv/programs/mythbackend/mainserver.cpp b/mythtv/programs/mythbackend/mainserver.cpp
index 8996d48..1895619 100644
a
|
b
|
void MainServer::HandleGoToSleep(PlaybackSock *pbs) |
2780 | 2780 | QString sleepCmd = gCoreContext->GetSetting("SleepCommand"); |
2781 | 2781 | if (!sleepCmd.isEmpty()) |
2782 | 2782 | { |
2783 | | strlist << "OK"; |
| 2783 | int retval; |
| 2784 | retval = myth_system(sleepCmd); |
| 2785 | if (retval == 2) |
| 2786 | strlist << "BUSY"; |
| 2787 | else if (retval != GENERIC_EXIT_OK) |
| 2788 | strlist << "ERROR: SleepCommand exited with error"; |
| 2789 | else |
| 2790 | strlist << "OK"; |
2784 | 2791 | SendResponse(pbs->getSocket(), strlist); |
2785 | 2792 | LOG(VB_GENERAL, LOG_NOTICE, |
2786 | 2793 | "Received GO_TO_SLEEP command from master, running SleepCommand."); |
2787 | | myth_system(sleepCmd); |
2788 | 2794 | } |
2789 | 2795 | else |
2790 | 2796 | { |
diff --git a/mythtv/programs/mythbackend/playbacksock.cpp b/mythtv/programs/mythbackend/playbacksock.cpp
index 65a49ac..7dbcea6 100644
a
|
b
|
bool PlaybackSock::SendReceiveStringList( |
107 | 107 | |
108 | 108 | /** \brief Tells a slave to go to sleep |
109 | 109 | */ |
110 | | bool PlaybackSock::GoToSleep(void) |
| 110 | int PlaybackSock::GoToSleep(void) |
111 | 111 | { |
112 | | QStringList strlist(QString("GO_TO_SLEEP")); |
| 112 | QStringList strlist( QString("GO_TO_SLEEP") ); |
113 | 113 | |
114 | | return SendReceiveStringList(strlist, 1) && (strlist[0] == "OK"); |
| 114 | if (SendReceiveStringList(strlist, 1)) |
| 115 | { |
| 116 | if (strlist[0] == "OK") |
| 117 | return 1; |
| 118 | else if (strlist[0] == "BUSY") |
| 119 | return -1; |
| 120 | } |
| 121 | |
| 122 | return 0; |
115 | 123 | } |
116 | 124 | |
117 | 125 | /** |
diff --git a/mythtv/programs/mythbackend/playbacksock.h b/mythtv/programs/mythbackend/playbacksock.h
index c273604..c61cde4 100644
a
|
b
|
class PlaybackSock : public ReferenceCounter |
59 | 59 | void setIP(QString &lip) { ip = lip; } |
60 | 60 | QString getIP(void) const { return ip; } |
61 | 61 | |
62 | | bool GoToSleep(void); |
| 62 | int GoToSleep(void); |
63 | 63 | void GetDiskSpace(QStringList &o_strlist); |
64 | 64 | int DeleteFile(const QString &filename, const QString &sgroup); |
65 | 65 | int StopRecording(const ProgramInfo *pginfo); |
diff --git a/mythtv/programs/mythbackend/scheduler.cpp b/mythtv/programs/mythbackend/scheduler.cpp
index 0f0e917..354f331 100644
a
|
b
|
void Scheduler::PutInactiveSlavesToSleep(void) |
2953 | 2953 | { |
2954 | 2954 | int prerollseconds = 0; |
2955 | 2955 | int secsleft = 0; |
| 2956 | int retval = 0; |
2956 | 2957 | EncoderLink *enc = NULL; |
2957 | 2958 | |
2958 | 2959 | bool someSlavesCanSleep = false; |
… |
… |
void Scheduler::PutInactiveSlavesToSleep(void) |
3062 | 3063 | QString(" Commanding %1 to go to sleep.") |
3063 | 3064 | .arg(thisHost)); |
3064 | 3065 | |
3065 | | if (enc->GoToSleep()) |
| 3066 | retval = enc->GoToSleep(); |
| 3067 | |
| 3068 | if (retval == -1) |
| 3069 | { |
| 3070 | VERBOSE(VB_IMPORTANT, LOC_WARN + QString("Unable to " |
| 3071 | "shutdown %1 slave backend, reported " |
| 3072 | "back BUSY. Doing nothing.").arg(thisHost)); |
| 3073 | break; |
| 3074 | } |
| 3075 | else if (retval == 1) |
3066 | 3076 | { |
3067 | 3077 | QMap<int, EncoderLink *>::Iterator slviter = |
3068 | 3078 | m_tvList->begin(); |