From: mirv Date: Sun, 6 Jan 2008 10:44:44 +0000 (+0100) Subject: allow reread of tps.cache X-Git-Tag: 0.9.0~45 X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=7b47e909aaca63eedf641af977bd2d148357732c;p=sasc-ng.git allow reread of tps.cache --- diff --git a/systems/viaccess/tps.c b/systems/viaccess/tps.c index 7751510..051e022 100644 --- a/systems/viaccess/tps.c +++ b/systems/viaccess/tps.c @@ -569,16 +569,17 @@ public: cTpsKeys tpskeys; cTpsKeys::cTpsKeys(void) -:cStructListPlain("TPS keys","tps.cache",SL_READWRITE|SL_MISSINGOK|SL_NOPURGE) +:cStructListPlain("TPS keys","tps.cache",SL_READWRITE|SL_MISSINGOK|SL_WATCH|SL_NOPURGE) ,lastLoad(-LOADBIN_TIME) ,lastAu(-TPSAU_TIME) { - first=last=0; algomem=0; + first=last=0; algomem=0; loadlist=0; } cTpsKeys::~cTpsKeys() { free(algomem); + delete loadlist; } const cTpsKey *cTpsKeys::GetKey(time_t t) @@ -891,6 +892,18 @@ void cTpsKeys::DecryptBin(const unsigned char *in, unsigned char *out) } */ +void cTpsKeys::PreLoad(void) +{ + delete loadlist; + loadlist=new cSimpleList; + if(!loadlist) PRINTF(L_SYS_TPS,"no memory for loadlist"); +} + +void cTpsKeys::PostLoad(void) +{ + if(loadlist) Join(loadlist); +} + bool cTpsKeys::ParseLinePlain(const char *line) { unsigned char tmp[60]; @@ -937,7 +950,7 @@ bool cTpsKeys::ParseLinePlain(const char *line) unsigned int crc=crc32_le(0,&tmp[4],sizeof(tmp)-4); if(*((unsigned int *)tmp)==crc) { cTpsKey *k=new cTpsKey; - if(k) { k->Set(&tmp[4]); Add(k); } + if(k) { k->Set(&tmp[4]); if(loadlist) loadlist->Add(k); } return true; } else PRINTF(L_SYS_TPS,"CRC failed during cache load"); diff --git a/systems/viaccess/tps.h b/systems/viaccess/tps.h index 0d04baf..e1c03db 100644 --- a/systems/viaccess/tps.h +++ b/systems/viaccess/tps.h @@ -110,6 +110,7 @@ class cTpsKeys : public cStructListPlain, private cTPSDecrypt { friend class cTpsAuHook; private: time_t first, last; + cSimpleList *loadlist; // cTimeMs lastCheck, lastLoad, lastAu; cMutex checkMutex; @@ -126,6 +127,8 @@ private: bool ProcessAu(const cOpenTVModule *mod); protected: virtual bool ParseLinePlain(const char *line); + virtual void PreLoad(void); + virtual void PostLoad(void); virtual void PostSave(FILE *f); public: cTpsKeys(void);