]> www.vanbest.org Git - sasc-ng.git/commitdiff
cardclient-cccam2: limit max ECM processing time
authorleslie <unknown>
Wed, 5 Aug 2009 13:27:29 +0000 (21:27 +0800)
committerleslie <unknown>
Wed, 5 Aug 2009 13:27:29 +0000 (21:27 +0800)
systems/cardclient/cccam2.c

index 7b61113e741d4f6a06f33a2ab73ffa02ba8cc913..09390b269c7bbad578f7c8357ff720254f998a19 100644 (file)
@@ -227,7 +227,7 @@ public:
 // -- cShare -------------------------------------------------------------------
 
 #define STDLAG 1000
-#define MAXLAG 7000
+#define MAXLAG 5000
 
 class cShares;
 
@@ -364,6 +364,8 @@ int cShares::GetShares(const cEcmInfo *ecm, cShares *ss)
 
 // -- cCardClientCCcam2 ---------------------------------------------------------
 
+#define MAX_ECM_TIME (MAXLAG*3+2000) // ms
+
 class cCardClientCCcam2 : public cCardClient , private cThread {
 private:
   cCCcamCrypt encr, decr;
@@ -665,7 +667,8 @@ bool cCardClientCCcam2::ProcessECM(const cEcmInfo *ecm, const unsigned char *dat
     for(cShare *s=curr.First(); s; s=curr.Next(s))
       PRINTF(L_CC_CCCAM2,"shareid %08x %c hops %d lag %4d: caid %04x",s->ShareID(),s->Status()>0?'+':(s->Status()<0?'-':' '),s->Hops(),s->Lag(),s->CaID());
     }
-  for(cShare *s=curr.First(); s; s=curr.Next(s)) {
+  cTimeMs max(MAX_ECM_TIME);
+  for(cShare *s=curr.First(); s && !max.TimedOut(); s=curr.Next(s)) {
     if((shareid=s->ShareID())==0) continue;
     buffer[ECM_SHAREID_POS]=shareid>>24;
     buffer[ECM_SHAREID_POS+1]=shareid>>16;