Fixed taking an active SVDRP connection into account when doing shutdown

This commit is contained in:
Klaus Schmidinger 2002-12-13 14:31:17 +01:00
parent 7d0596878b
commit 2343e7ec14
3 changed files with 10 additions and 3 deletions

View File

@ -386,6 +386,7 @@ Rudi Hofer (Rudi.Hofer@cadsoft.de)
Gregoire Favre <greg@ulima.unil.ch> Gregoire Favre <greg@ulima.unil.ch>
for fixing some function headers to make them compile with gcc 3.x for fixing some function headers to make them compile with gcc 3.x
for reporting a bug in taking an active SVDRP connection into account when doing shutdown
Sven Grothklags <sven@uni-paderborn.de> Sven Grothklags <sven@uni-paderborn.de>
for fixing the cutting mechanism to make it re-sync in case a frame is larger for fixing the cutting mechanism to make it re-sync in case a frame is larger

View File

@ -1867,3 +1867,5 @@ Video Disk Recorder Revision History
- Now checking if there is a connection to the keyboard (thanks to Jaakko Hyvätti) - Now checking if there is a connection to the keyboard (thanks to Jaakko Hyvätti)
and only creating the KBD remote control if VDR is running in the foreground. and only creating the KBD remote control if VDR is running in the foreground.
- Fixed taking an active SVDRP connection into account when doing shutdown (thanks
to Gregoire Favre for reporting this one).

10
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.cadsoft.de/people/kls/vdr * The project's page is at http://www.cadsoft.de/people/kls/vdr
* *
* $Id: vdr.c 1.138 2002/12/13 13:37:28 kls Exp $ * $Id: vdr.c 1.139 2002/12/13 14:30:00 kls Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -424,6 +424,7 @@ int main(int argc, char *argv[])
time_t LastActivity = 0; time_t LastActivity = 0;
int MaxLatencyTime = 0; int MaxLatencyTime = 0;
bool ForceShutdown = false; bool ForceShutdown = false;
bool UserShutdown = false;
if (WatchdogTimeout > 0) { if (WatchdogTimeout > 0) {
dsyslog("setting watchdog timer to %d seconds", WatchdogTimeout); dsyslog("setting watchdog timer to %d seconds", WatchdogTimeout);
@ -539,6 +540,7 @@ int main(int argc, char *argv[])
ForceShutdown = true; ForceShutdown = true;
} }
LastActivity = 1; // not 0, see below! LastActivity = 1; // not 0, see below!
UserShutdown = true;
break; break;
default: break; default: break;
} }
@ -647,7 +649,7 @@ int main(int argc, char *argv[])
Interface->Info(tr("Editing process finished")); Interface->Info(tr("Editing process finished"));
} }
} }
if (!Interact && ((!cRecordControls::Active() && !cCutter::Active() && !Interface->HasSVDRPConnection()) || ForceShutdown)) { if (!Interact && ((!cRecordControls::Active() && !cCutter::Active() && (!Interface->HasSVDRPConnection() || UserShutdown)) || ForceShutdown)) {
time_t Now = time(NULL); time_t Now = time(NULL);
if (Now - LastActivity > ACTIVITYTIMEOUT) { if (Now - LastActivity > ACTIVITYTIMEOUT) {
// Shutdown: // Shutdown:
@ -665,12 +667,13 @@ int main(int argc, char *argv[])
else else
LastActivity = 1; LastActivity = 1;
} }
bool UserShutdown = key == kPower;
if (UserShutdown && Next && Delta <= Setup.MinEventTimeout * 60 && !ForceShutdown) { if (UserShutdown && Next && Delta <= Setup.MinEventTimeout * 60 && !ForceShutdown) {
char *buf; char *buf;
asprintf(&buf, tr("Recording in %d minutes, shut down anyway?"), Delta / 60); asprintf(&buf, tr("Recording in %d minutes, shut down anyway?"), Delta / 60);
if (Interface->Confirm(buf)) if (Interface->Confirm(buf))
ForceShutdown = true; ForceShutdown = true;
else
UserShutdown = false;
free(buf); free(buf);
} }
if (!Next || Delta > Setup.MinEventTimeout * 60 || ForceShutdown) { if (!Next || Delta > Setup.MinEventTimeout * 60 || ForceShutdown) {
@ -694,6 +697,7 @@ int main(int argc, char *argv[])
signal(SIGALRM, SIG_IGN); signal(SIGALRM, SIG_IGN);
} }
LastActivity = time(NULL); // don't try again too soon LastActivity = time(NULL); // don't try again too soon
UserShutdown = false;
continue; // skip the rest of the housekeeping for now continue; // skip the rest of the housekeeping for now
} }
} }