Changeset 8643
- Timestamp:
- 05/13/13 01:33:28 (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/globals.h
r8640 r8643 1068 1068 uint16_t srvid; 1069 1069 time_t last; 1070 uchar kindecm; 1070 1071 uchar ecmd5[CS_ECMSTORESIZE]; 1071 1072 -
trunk/oscam-chk.c
r8640 r8643 21 21 reader->rlecmh[h].last = -1; 22 22 reader->rlecmh[h].srvid = -1; 23 reader->rlecmh[h].kindecm = 0; 23 24 } 24 25 } … … 30 31 31 32 // check ecmunique if enabled and ecmunique time is done 32 if(reader_mode && reader->ecmunique && (actualtime - reader->rlecmh[h].last < reader->ratelimitseconds)) { 33 if (memcmp(reader->rlecmh[h].ecmd5, er->ecmd5, CS_ECMSTORESIZE)){ 34 char ecmd5[17*3]; 35 cs_hexdump(0, reader->rlecmh[h].ecmd5, 16, ecmd5, sizeof(ecmd5)); 36 cs_debug_mask(D_TRACE, "ratelimiter ecm %s in this slot for next %d seconds -> skipping this slot!", ecmd5, (int) 37 (reader->ratelimitseconds - (actualtime - reader->rlecmh[h].last))); 33 if(reader_mode && reader->ecmunique){ 34 if(actualtime - reader->rlecmh[h].last < reader->ratelimitseconds) { 35 if (memcmp(reader->rlecmh[h].ecmd5, er->ecmd5, CS_ECMSTORESIZE)){ 36 if (er->ecm[0]== reader->rlecmh[h].kindecm){ 37 char ecmd5[17*3]; 38 cs_hexdump(0, reader->rlecmh[h].ecmd5, 16, ecmd5, sizeof(ecmd5)); 39 cs_debug_mask(D_TRACE, "ratelimiter ecm %s in this slot for next %d seconds -> returning same controlword!", ecmd5, (int) 40 (reader->ratelimitseconds - (actualtime - reader->rlecmh[h].last))); 41 memcpy(er->ecmd5, reader->rlecmh[h].ecmd5, CS_ECMSTORESIZE); // replace md5 hash 42 return -2; 43 } 44 } 45 } 46 if (er->ecm[0]== reader->rlecmh[h].kindecm && (actualtime - reader->rlecmh[h].last <= reader->ratelimitseconds + reader->srvidholdseconds) && (reader->rlecmh[h].last !=-1)){ 47 cs_debug_mask(D_TRACE, "ratelimiter srvid %04X ecm type %s, only allowing %s for next %d seconds in slot #%d/%d of reader %s -> skipping this slot!", 48 reader->rlecmh[h].srvid, (reader->rlecmh[h].kindecm == 0x80?"even":"odd"), (reader->rlecmh[h].kindecm == 0x80?"odd":"even"), 49 (int) (reader->ratelimitseconds + reader->srvidholdseconds - (actualtime - reader->rlecmh[h].last)), h+1, maxloop, reader->label); 38 50 continue; 39 51 } 40 52 } 53 41 54 if (h > 0){ 42 55 for (foundspace = 0; foundspace < h; foundspace++) { // check for free lower slot … … 112 125 } 113 126 foundspace = ecm_ratelimit_findspace(reader, er, maxslots, reader_mode); 114 if (foundspace < 0 || foundspace >= reader->ratelimitecm) { /* No space due to ratelimit */ 127 if (foundspace == -2){ // trick to trigger cache (I hope) 128 if (!reader_mode) return OK; 129 else return ERROR; 130 } 131 if (foundspace == -1 || foundspace >= reader->ratelimitecm) { /* No space due to ratelimit */ 115 132 if (!reader_mode) return OK; // who's calling us? reader or some stat prober? If reader then register otherwise just report! 116 133 if (reader->cooldown[0] && reader->cooldownstate == 0){ // we are in setup phase of cooldown … … 156 173 reader->rlecmh[foundspace].srvid=er->srvid; 157 174 memcpy(reader->rlecmh[foundspace].ecmd5, er->ecmd5, CS_ECMSTORESIZE);// register ecmhash 175 reader->rlecmh[foundspace].kindecm = er->ecm[0]; // register kind of ecm 158 176 } 159 177 if (reader->cooldown[0] && reader->cooldownstate == 2) { // check if cooldowndelay is elapsed
Note:
See TracChangeset
for help on using the changeset viewer.