uint32_t get_cacheex_wait_time(ECM_REQUEST *er, struct s_client *cl) { int32_t i, dwtime = -1, awtime = -1; for(i = 0; i < cfg.cacheex_wait_timetab.cevnum; i++) { CECSPVALUETAB_DATA *d = &cfg.cacheex_wait_timetab.cevdata[i]; if(i == 0 && d->caid <= 0) { dwtime = d->dwtime; awtime = d->awtime; continue; //check other, only valid for unset } if(d->caid == er->caid || d->caid == er->caid >> 8 || ((d->cmask >= 0 && (er->caid & d->cmask) == d->caid) || d->caid == -1)) { if((d->prid >= 0 && d->prid == (int32_t)er->prid) || d->prid == -1) { if((d->srvid >= 0 && d->srvid == er->srvid) || d->srvid == -1) { dwtime = d->dwtime; awtime = d->awtime; break; } } } } if(awtime > 0 && (dwtime <= 0 || awtime==dwtime) ) //if awtime==dwtime useless check hitcache { return awtime; } if(cl == NULL) { if(dwtime < 0) { dwtime = 0; } return dwtime; } if(awtime > 0 || dwtime > 0) { //if found last in cache return dynwaittime else alwayswaittime if(cacheex_check_hitcache(er,cl)) { return dwtime >= awtime ? dwtime : awtime; } else { return awtime > 0 ? awtime : 0; } } return 0; }
uint32_t get_cacheex_wait_time(ECM_REQUEST *er, struct s_client *cl) { int32_t i, dwtime = -1, awtime = -1; for(i = 0; i < cfg.cacheex_wait_timetab.n; i++) { if(i == 0 && cfg.cacheex_wait_timetab.caid[i] <= 0) { dwtime = cfg.cacheex_wait_timetab.dwtime[i]; awtime = cfg.cacheex_wait_timetab.awtime[i]; continue; //check other, only valid for unset } if(cfg.cacheex_wait_timetab.caid[i] == er->caid || cfg.cacheex_wait_timetab.caid[i] == er->caid >> 8 || ((cfg.cacheex_wait_timetab.cmask[i] >= 0 && (er->caid & cfg.cacheex_wait_timetab.cmask[i]) == cfg.cacheex_wait_timetab.caid[i]) || cfg.cacheex_wait_timetab.caid[i] == -1)) { if((cfg.cacheex_wait_timetab.prid[i] >= 0 && cfg.cacheex_wait_timetab.prid[i] == (int32_t)er->prid) || cfg.cacheex_wait_timetab.prid[i] == -1) { if((cfg.cacheex_wait_timetab.srvid[i] >= 0 && cfg.cacheex_wait_timetab.srvid[i] == er->srvid) || cfg.cacheex_wait_timetab.srvid[i] == -1) { dwtime = cfg.cacheex_wait_timetab.dwtime[i]; awtime = cfg.cacheex_wait_timetab.awtime[i]; break; } } } } if(awtime > 0 && (dwtime <= 0 || awtime==dwtime) ) //if awtime==dwtime useless check hitcache { return awtime; } if(cl == NULL) { if(dwtime < 0) { dwtime = 0; } return dwtime; } if(awtime > 0 || dwtime > 0) { //if found last in cache return dynwaittime else alwayswaittime if(cacheex_check_hitcache(er,cl)) { return dwtime >= awtime ? dwtime : awtime; } else { return awtime > 0 ? awtime : 0; } } return 0; }