Changeset 8444


Ignore:
Timestamp:
02/28/13 22:14:52 (8 years ago)
Author:
theparasol
Message:
  • Added srvidholdseconds to ratelimiter (experimental) a srvid will be kept in slot for additional srvidholdseconds if used with enabled ecmunique, the ecm in slot must be ratelimitseconds unique

E.G. CDS NL 0100:00006A


ratelimitecm = 4
ratelimitseconds = 10
srvidholdseconds = 5
ecmunique = 1

Assign 4 srvid slots
Ecm for srvid in slot is unique for 10 seconds
Slotted srvid will be released after 10+5 = 15 seconds of inactivity

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/globals.h

    r8432 r8444  
    13641364    int32_t         ratelimitecm;
    13651365    int32_t         ratelimitseconds;
    1366     int8_t          ecmunique; // check for matching ecm hash in ratelimitslot 
     1366    int8_t          ecmunique; // check for matching ecm hash in ratelimitslot
     1367    int32_t         srvidholdseconds; // seconds to keep srvid in ratelimitslot (during this time not checked for ecmunique!)
    13671368    time_t          lastdvbapirateoverride;
    13681369    uint32_t        ecmsok;
  • trunk/module-webif.c

    r8437 r8444  
    14251425        tpl_printf(vars, TPLADD, "RATELIMITECM", "%d", rdr->ratelimitecm);
    14261426        tpl_printf(vars, TPLADD, "RATELIMITSECONDS", "%d", rdr->ratelimitseconds);
     1427        tpl_printf(vars, TPLADD, "SRVIDHOLDSECONDS", "%d", rdr->srvidholdseconds);
    14271428        // ECMUNIQUE
    14281429        if(!apicall) {
  • trunk/oscam-chk.c

    r8432 r8444  
    1616    time_t actualtime = time(NULL);
    1717    for (h = 0; h < maxloop; h++) { // always release slots with srvid that are overtime, even if not called from reader module to maximize available slots!
    18         if ((actualtime - reader->rlecmh[h].last >= reader->ratelimitseconds) && (reader->rlecmh[h].last !=-1)){
    19             cs_debug_mask(D_TRACE, "ratelimiter old srvid %04X released from slot #%d/%d of reader %s (%d>=%d ratelimitsec!)", reader->rlecmh[h].srvid, h+1, maxloop, reader->label, (int) (actualtime - reader->rlecmh[h].last), reader->ratelimitseconds);
     18        if ((actualtime - reader->rlecmh[h].last >= reader->ratelimitseconds + reader->srvidholdseconds) && (reader->rlecmh[h].last !=-1)){
     19            cs_debug_mask(D_TRACE, "ratelimiter srvid %04X released from slot #%d/%d of reader %s (%d>=%d ratelimitsec + %d sec srvidhold!)", reader->rlecmh[h].srvid, h+1, maxloop, reader->label, (int) (actualtime - reader->rlecmh[h].last), reader->ratelimitseconds, reader->srvidholdseconds);
    2020            reader->rlecmh[h].last = -1;
    2121            reader->rlecmh[h].srvid = -1;
     
    2525    for (h = 0; h < maxloop; h++) { // check if srvid is already in a slot
    2626        if (reader->rlecmh[h].srvid == er->srvid) {
    27             cs_debug_mask(D_TRACE, "ratelimiter found srvid %04X for %d sec in slot #%d/%d of reader %s",er->srvid, (int) (actualtime - reader->rlecmh[h].last), h+1, maxloop,reader->label);
     27            cs_debug_mask(D_TRACE, "ratelimiter found srvid %04X for %d sec in slot #%d/%d of reader %s",er->srvid,
     28                (int) (actualtime - reader->rlecmh[h].last), h+1, maxloop,reader->label);
    2829           
    29             if(reader_mode && reader->ecmunique){ // allow just 1 ecm in a slot instead of a srvid
     30            // check ecmunique if enabled and ecmunique time is done
     31            if(reader_mode && reader->ecmunique && (actualtime - reader->rlecmh[h].last < reader->ratelimitseconds)) {
    3032                if (memcmp(reader->rlecmh[h].ecmd5, er->ecmd5, CS_ECMSTORESIZE)){
    3133                    char ecmd5[17*3];
     
    6264    foundspace = -1;
    6365    if ((cfg.dvbapi_enabled == 1) && streq(er->client->account->usr, cfg.dvbapi_usr)) {
    64         if ((reader->lastdvbapirateoverride) < (time(NULL) - reader->ratelimitseconds)) {
    65             time_t minecmtime = time(NULL);
     66        if ((reader->lastdvbapirateoverride) < (actualtime - reader->ratelimitseconds)) {
     67            time_t minecmtime = actualtime;
    6668            for (h = 0; h < maxloop; h++) {
    6769                if(reader->rlecmh[h].last < minecmtime) {
     
    7072                }
    7173            }
    72             reader->lastdvbapirateoverride = time(NULL);
     74            reader->lastdvbapirateoverride = actualtime;
    7375            cs_debug_mask(D_TRACE, "prioritizing DVBAPI user %s over other watching client", er->client->account->usr);
    7476            cs_debug_mask(D_TRACE, "ratelimiter forcing srvid %04X into slot #%d/%d of reader %s", er->srvid, foundspace+1, maxloop, reader->label);
  • trunk/oscam-config-reader.c

    r8432 r8444  
    794794    DEF_OPT_FUNC("ratelimitseconds"     , 0,                            ratelimitseconds_fn ),
    795795    DEF_OPT_INT8("ecmunique"            , OFS(ecmunique),               0 ),
     796    DEF_OPT_INT8("srvidholdseconds"     , OFS(srvidholdseconds),        0 ),
    796797    DEF_OPT_FUNC("cooldown"             , 0,                            cooldown_fn ),
    797798    DEF_OPT_FUNC("cooldowndelay"        , 0,                            cooldowndelay_fn ),
     
    821822#endif
    822823        "deprecated", "ndsversion", "ratelimitecm", "ratelimitseconds",
    823         "cooldown", "ecmunique",
     824        "cooldown", "ecmunique", "srvidholdseconds",
    824825        0
    825826    };
  • trunk/webif/readerconfig/readerconfig_hwreader.html

    r8432 r8444  
    99                <TR><TD>##TPLHELPPREFIX##server#ecmunique##TPLHELPSUFFIX##ECM Unique:</A><input name="ecmunique" type="hidden" value="0"></TD><TD><input name="ecmunique" type="checkbox" value="1" ##ECMUNIQUECHECKED##></TD></TR>
    1010                <TR><TD>##TPLHELPPREFIX##server#ratelimitseconds##TPLHELPSUFFIX##Ratelimit seconds:</A></TD><TD><input name="ratelimitseconds" type="text" size="5" maxlength="5" value="##RATELIMITSECONDS##"></TD></TR>
     11                <TR><TD>##TPLHELPPREFIX##server#srvidholdseconds##TPLHELPSUFFIX##Seconds to hold SRVID in slot:</A></TD><TD><input name="srvidholdseconds" type="text" size="5" maxlength="5" value="##SRVIDHOLDSECONDS##"></TD></TR>
    1112                <TR><TD>##TPLHELPPREFIX##server#cooldowndelay##TPLHELPSUFFIX##Cooldown Delay:</A></TD><TD><input name="cooldowndelay" type="text" size="5" maxlength="5" value="##COOLDOWNDELAY##"></TD></TR>
    1213                <TR><TD>##TPLHELPPREFIX##server#cooldowntime##TPLHELPSUFFIX##Cooldown Time:</A></TD><TD><input name="cooldowntime" type="text" size="5" maxlength="5" value="##COOLDOWNTIME##"></TD></TR>
Note: See TracChangeset for help on using the changeset viewer.