diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2014-01-16 11:57:54 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2014-01-16 11:57:54 +0100 |
commit | 1df6a87249291566d978f3d104ca68dbb075b37b (patch) | |
tree | 06b09b7d54471b34156392055347fbc48da0b552 /ci.c | |
parent | e02d608bce5e4c4f484f7e9bd81e23637968d10c (diff) | |
download | vdr-1df6a87249291566d978f3d104ca68dbb075b37b.tar.gz vdr-1df6a87249291566d978f3d104ca68dbb075b37b.tar.bz2 |
Now waiting explicitly until all CAM slots are ready before switching to the initial channel when VDR is started
Diffstat (limited to 'ci.c')
-rw-r--r-- | ci.c | 33 |
1 files changed, 21 insertions, 12 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: ci.c 3.7 2014/01/15 10:20:48 kls Exp $ + * $Id: ci.c 3.8 2014/01/16 11:43:33 kls Exp $ */ #include "ci.h" @@ -1536,15 +1536,6 @@ void cCiAdapter::AddCamSlot(cCamSlot *CamSlot) } } -bool cCiAdapter::Ready(void) -{ - for (int i = 0; i < MAX_CAM_SLOTS_PER_ADAPTER; i++) { - if (camSlots[i] && !camSlots[i]->Ready()) - return false; - } - return true; -} - void cCiAdapter::Action(void) { cTPDU TPDU; @@ -1566,8 +1557,6 @@ void cCiAdapter::Action(void) // --- cCamSlot -------------------------------------------------------------- -cCamSlots CamSlots; - #define MODULE_CHECK_INTERVAL 500 // ms #define MODULE_RESET_TIMEOUT 2 // s @@ -2034,6 +2023,26 @@ uchar *cCamSlot::Decrypt(uchar *Data, int &Count) return Data; } +// --- cCamSlots ------------------------------------------------------------- + +cCamSlots CamSlots; + +bool cCamSlots::WaitForAllCamSlotsReady(int Timeout) +{ + for (time_t t0 = time(NULL); time(NULL) - t0 < Timeout; ) { + bool ready = true; + for (cCamSlot *CamSlot = CamSlots.First(); CamSlot; CamSlot = CamSlots.Next(CamSlot)) { + if (!CamSlot->Ready()) { + ready = false; + cCondWait::SleepMs(100); + } + } + if (ready) + return true; + } + return false; +} + // --- cChannelCamRelation --------------------------------------------------- #define CAM_CHECKED_TIMEOUT 15 // seconds before a CAM that has been checked for a particular channel will be checked again |