]> www.vanbest.org Git - sasc-ng.git/commitdiff
allow reread of tps.cache
authormirv <unknown>
Sun, 6 Jan 2008 10:44:44 +0000 (11:44 +0100)
committermirv <unknown>
Sun, 6 Jan 2008 10:44:44 +0000 (11:44 +0100)
systems/viaccess/tps.c
systems/viaccess/tps.h

index 7751510b292ca3445f058f66b64502870383f96d..051e022981a62c249e72da998f0c7ba54c01b980 100644 (file)
@@ -569,16 +569,17 @@ public:
 cTpsKeys tpskeys;
 
 cTpsKeys::cTpsKeys(void)
-:cStructListPlain<cTpsKey>("TPS keys","tps.cache",SL_READWRITE|SL_MISSINGOK|SL_NOPURGE)
+:cStructListPlain<cTpsKey>("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<cTpsKey>;
+  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");
index 0d04baf8f7e1c66fdaa29d8a5ccf4b96e9ffe09c..e1c03db08f88c55d250adf91dd6b37badecb5780 100644 (file)
@@ -110,6 +110,7 @@ class cTpsKeys : public cStructListPlain<cTpsKey>, private cTPSDecrypt {
 friend class cTpsAuHook;
 private:
   time_t first, last;
+  cSimpleList<cTpsKey> *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);