Changeset 8358 for trunk/oscam-ecm.c


Ignore:
Timestamp:
02/16/13 23:01:27 (3 years ago)
Author:
TNe-TWo
Message:

cleanup/move cache settings
http://www.streamboard.tv/wbb2/thread.php?threadid=37089

cacheex mode 1 same dyn wait time as mode2/3/csp.
(one for all mode/csp)

fix that not only fallback rdr ask on stage 4
fix reader stat, to add only real rdr time to stat, when have wait_time
add real rdr time to log, when have wait_time

parameter change overview

[global] cachedelay -> [cache] delay
[global] max_cache_time -> [cache] max_time
[global] max_cache_count -> [cache] max_count
[global] cacheexenablestats -> [cache] cacheexenablestats
[csp] wait_time -> [cache] wait_time
[csp] port -> [cache] csp_port
[csp] serverip -> [cache] csp_serverip
[csp] csp_ecm_filter -> [cache] csp_ecm_filter
[csp] csp_allow_request -> [cache] csp_allow_request

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/oscam-ecm.c

    r8341 r8358  
    217217        return NULL;
    218218    cs_ftime(&er->tps);
     219#ifdef CS_CACHEEX
     220    er->cacheex_wait.time = er->tps.time;
     221    er->cacheex_wait.millitm = er->tps.millitm;
     222    er->cacheex_wait_time = 0;
     223#endif
    219224    er->rc     = E_UNHANDLED;
    220225    er->client = cl;
     
    443448
    444449    cs_ftime(&tpe);
     450
     451#ifdef CS_CACHEEX
     452    if (er->rc == E_FOUND && er->cacheex_wait_time)
     453        snprintf(sreason, sizeof(sreason)-1, " (real %d ms)", comp_timeb(&tpe, &er->cacheex_wait));
     454#endif
     455
    445456    client->cwlastresptime = 1000 * (tpe.time-er->tps.time) + tpe.millitm-er->tps.millitm;
    446457
     
    624635#ifdef CS_CACHEEX
    625636            case 1: {
    626                 // Cache-Echange
     637                // Cache-Exchange
    627638                if ((ea->status & REQUEST_SENT) ||
    628639                        (ea->status & (READER_CACHEEX|READER_ACTIVE)) != (READER_CACHEEX|READER_ACTIVE))
     
    647658            default: {
    648659                // only fallbacks
    649                 if (!(ea->status & (READER_ACTIVE|READER_FALLBACK)))
     660                if ((ea->status & (READER_ACTIVE|READER_FALLBACK)) != (READER_ACTIVE|READER_FALLBACK))
    650661                    continue;
    651662                if (ea->status & REQUEST_SENT) {
     
    14041415#ifdef CS_CACHEEX
    14051416    int8_t cacheex = client->account ? client->account->cacheex.mode : 0;
    1406     uint32_t c_csp_wait_time = get_csp_wait_time(er,client);
    1407     cs_debug_mask(D_CACHEEX | D_CSPCWC, "[GET_CW] c_csp_wait_time %d caid %04X prov %06X srvid %04X rc %d cacheex %d", c_csp_wait_time, er->caid, er->prid, er->srvid, er->rc, cacheex);
    1408     if ((cacheex == 1 || c_csp_wait_time) && er->rc == E_UNHANDLED) { //not found in cache, so wait!
    1409         int32_t max_wait = (cacheex == 1)?cfg.cacheex_wait_time:c_csp_wait_time; // uint32_t can't value <> n/50
     1417    uint32_t cacheex_wait_time = get_cacheex_wait_time(er,client);
     1418    cs_debug_mask(D_CACHEEX | D_CSPCWC, "[GET_CW] c_csp_wait_time %d caid %04X prov %06X srvid %04X rc %d cacheex %d", cacheex_wait_time, er->caid, er->prid, er->srvid, er->rc, cacheex);
     1419    if ((cacheex_wait_time) && er->rc == E_UNHANDLED) { //not found in cache, so wait!
     1420        add_ms_to_timeb(&er->cacheex_wait, cacheex_wait_time);
     1421        er->cacheex_wait_time = cacheex_wait_time;
     1422        int32_t max_wait = cacheex_wait_time; // uint32_t can't value <> n/50
    14101423        while (max_wait > 0 && !client->kill) {
    14111424            cs_sleepms(50);
     
    14251438            }
    14261439        }
    1427         if (max_wait <= 0 )
     1440        if (max_wait <= 0 ) {
    14281441            cs_debug_mask(D_CACHEEX|D_CSPCWC, "[GET_CW] wait_time over");
     1442            snprintf(er->msglog, MSGLOGSIZE, "wait_time over");
     1443        }
    14291444    }
    14301445#endif
     
    14561471    if (er->rc < E_99) {
    14571472#ifdef CS_CACHEEX
    1458         if (cfg.delay && cacheex != 1) //No delay on cacheexchange!
     1473        if (cfg.delay && cacheex != 1) //No delay on cacheexchange mode 1 client!
    14591474            cs_sleepms(cfg.delay);
    14601475
Note: See TracChangeset for help on using the changeset viewer.