From patchwork Sat Dec 2 10:30:20 2006 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Schmidinger X-Patchwork-Id: 12411 Received: from raven.cadsoft.de ([217.7.101.211]) by www.linuxtv.org with esmtp (Exim 4.50) id 1GqS8d-00065x-9y for vdr@linuxtv.org; Sat, 02 Dec 2006 11:30:31 +0100 Received: from [192.168.100.10] (hawk.cadsoft.de [192.168.100.10]) by raven.cadsoft.de (8.13.3/8.13.3) with ESMTP id kB2AUMT7016720 for ; Sat, 2 Dec 2006 11:30:23 +0100 Message-ID: <457155BC.6000303@cadsoft.de> Date: Sat, 02 Dec 2006 11:30:20 +0100 From: Klaus Schmidinger Organization: CadSoft Computer GmbH User-Agent: Thunderbird 1.5.0.4 (X11/20060516) MIME-Version: 1.0 To: vdr@linuxtv.org Subject: Re: [vdr] vdr shutdown handling / streamdev plugin References: <200611141003.07963.vdr-ml@jwendel.de> <455A0A71.4030805@gmx.de> <45704E75.2040000@cadsoft.de> <457053E3.7060104@gmx.de> <457056E1.4040607@cadsoft.de> <457066C2.6080000@gmx.de> In-Reply-To: <457066C2.6080000@gmx.de> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (raven.cadsoft.de [192.168.1.1]); Sat, 02 Dec 2006 11:30:23 +0100 (CET) X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Dec 2006 10:30:31 -0000 Status: O X-Status: X-Keywords: X-UID: 11309 Udo Richter wrote: > Klaus Schmidinger wrote: >> Are you sure? >> ACTIVITYTIMEOUT is 60 seconds, so wouldn't your change just >> avoid the calls until 60 seconds after the last user activity? > > Hmm, you're right. Its not a test on Setup.MinUserInactivity * 60. My > patch would just avoid these calls the usual 60 seconds after a key press. > > However, I still think that Active() should be called only if VDR is > really willing to shut down, and not while running normally. Or is > Active() supposed to also delay any housekeeping tasks? Since cPlugin::Active() is only intended to be a means of preventing VDR from shutting down, I'd say you're right - it should only be called when VDR is actually trying to shut down. The attached patch makes it call cPluginManager::Active() only if it really wants to shut down, and if there is actually an option for plugins to delay the shutdown (i.e. this is not a forced shutdown). If cPluginManager::Active() returns 'true' once, it waits for SHUTDOWNRETRY minutes before trying again. Please give this a try and let me know whether it works. Klaus --- vdr.c 2006/10/14 10:01:32 1.280 +++ vdr.c 2006/12/02 10:20:30 @@ -1154,11 +1154,15 @@ Skins.Message(mtInfo, tr("Editing process finished")); } } - if (!Interact && ((!cRecordControls::Active() && !cCutter::Active() && !cPluginManager::Active() && (!Interface->HasSVDRPConnection() || UserShutdown)) || ForceShutdown)) { + if (!Interact && ((!cRecordControls::Active() && !cCutter::Active() && (!Interface->HasSVDRPConnection() || UserShutdown)) || ForceShutdown)) { time_t Now = time(NULL); if (Now - LastActivity > ACTIVITYTIMEOUT) { // Shutdown: if (Shutdown && (Setup.MinUserInactivity || LastActivity == 1) && Now - LastActivity > Setup.MinUserInactivity * 60) { + if (!ForceShutdown && cPluginManager::Active()) { + LastActivity = time(NULL) - Setup.MinUserInactivity * 60 + SHUTDOWNRETRY; // try again later + continue; + } cTimer *timer = Timers.GetNextActiveTimer(); time_t Next = timer ? timer->StartTime() : 0; time_t Delta = timer ? Next - Now : 0;