Changeset 5352


Ignore:
Timestamp:
Jun 3, 2011, 1:56:08 PM (8 years ago)
Author:
schlocke
Message:

cccam: fixed auto refresh only for local cards, loadbalancer: do not
block timeouts if we got ecms in the past

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/module-cccam.c

    r5347 r5352  
    462462    while (cl->cc && cc->mode != CCCAM_MODE_SHUTDOWN && cs_trylock(&cc->lockcmd)) {
    463463        cs_debug_mask(D_TRACE, "%s trylock recv waiting", getprefix());
    464         cs_sleepms(50);
     464        cs_sleepms(fast_rnd());
    465465    }
    466466    if (!cl->cc || cc->mode == CCCAM_MODE_SHUTDOWN) return -1;
     
    533533    while (cl->cc && cc->mode != CCCAM_MODE_SHUTDOWN && cs_trylock(&cc->lockcmd)) { //We need this because cc_cmd_send is called from cccshare
    534534        cs_debug_mask(D_TRACE, "%s trylock send waiting", getprefix());
    535         cs_sleepms(50);
     535        cs_sleepms(fast_rnd());
    536536    }
    537537    if (!cl->cc || cc->mode == CCCAM_MODE_SHUTDOWN) return -1;
     
    11081108    while (cs_trylock(&cc->cards_busy)) {
    11091109        cs_debug_mask(D_TRACE, "%s trylock send_ecm cards waiting", getprefix());
    1110         cs_sleepms(50);
     1110        cs_sleepms(fast_rnd());
    11111111    }
    11121112    //forward_origin:
     
    13601360    while (cs_trylock(&cc->cards_busy)) {
    13611361        cs_debug_mask(D_TRACE, "trylock send_emm cards waiting", getprefix());
    1362         cs_sleepms(50);
     1362        cs_sleepms(fast_rnd());
    13631363    }
    13641364
     
    17801780            while (cs_trylock(&cc->cards_busy)) {
    17811781                cs_debug_mask(D_TRACE, "%s trylock MSG_SRV_DATA cards waiting", getprefix());
    1782                 cs_sleepms(50);
     1782                cs_sleepms(fast_rnd());
    17831783            }
    17841784            cc_free_cardlist(cc->cards, FALSE);
     
    18971897        while (cs_trylock(&cc->cards_busy)) {
    18981898            cs_debug_mask(D_TRACE, "%s trylock MSG_NEW_CARD cards waiting", getprefix());
    1899             cs_sleepms(50);
     1899            cs_sleepms(fast_rnd());
    19001900        }
    19011901
     
    19651965        while (cs_trylock(&cc->cards_busy)) {
    19661966            cs_debug_mask(D_TRACE, "%s trylock MSG_CARD_REMOVED cards waiting", getprefix());
    1967             cs_sleepms(50);
     1967            cs_sleepms(fast_rnd());
    19681968        }
    19691969        cc_card_removed(cl, b2i(4, buf + 4));
     
    20202020        while (cs_trylock(&cc->cards_busy)) {
    20212021            cs_debug_mask(D_TRACE, "%s trylock MSG_CW_NOK cards waiting", getprefix());
    2022             cs_sleepms(50);
     2022            cs_sleepms(fast_rnd());
    20232023        }
    20242024
     
    21752175            while (cs_trylock(&cc->cards_busy)) {
    21762176                cs_debug_mask(D_TRACE, "%s trylock MSG_CW_ECM cards waiting", getprefix());
    2177                 cs_sleepms(50);
     2177                cs_sleepms(fast_rnd());
    21782178            }
    21792179            cc->recv_ecmtask = -1;
     
    29212921            while (cs_trylock(&cc->cards_busy)) {
    29222922                cs_debug_mask(D_TRACE, "%s trylock cc_cli_connect cards waiting", getprefix());
    2923                 cs_sleepms(50);
     2923                cs_sleepms(fast_rnd());
    29242924            }
    29252925                           
  • trunk/module-cccshare.c

    r5346 r5352  
    741741int32_t card_timed_out(struct cc_card *card)
    742742{
    743     int32_t res = (card->timeout < time(NULL)); //card is older than 1h?
     743    int32_t res = (card->card_type != CT_REMOTECARD) && (card->timeout < time(NULL)); //local card is older than 1h?
    744744    if (res)
    745745        cs_debug_mask(D_TRACE, "card %08X timed out! refresh forced", card->id?card->id:card->origin_id);
  • trunk/module-stat.c

    r5339 r5352  
    457457    else if (rc == 5) { //timeout
    458458        stat = get_add_stat(rdr, er, prid);
     459       
    459460        //catch suddenly occuring timeouts and block reader:
    460461        if ((int)(ctime-stat->last_received) < (int)(5*cfg.ctimeout) &&
    461                         stat->rc == 0 &&
    462                         stat->ecm_count > 0) {
    463                 stat->rc = 5;
     462                stat->rc == 0 && stat->ecm_count == 0) {
     463            stat->rc = 5;
    464464                //inc_fail(stat); //do not inc fail factor in this case
    465465        }
    466         else if ((rdr->client->login+(int)(2*cfg.ctimeout/1000)) < ctime && rdr->client->pending < 5) { //reader is longer than 5s connected && not more then 5 pending ecms
    467                 stat->rc = 5;
    468                 inc_fail(stat);
     466        //reader is longer than 5s connected && not more then 5 pending ecms:
     467        else if ((rdr->client->login+(int)(2*cfg.ctimeout/1000)) < ctime && rdr->client->pending < 5 && 
     468                stat->rc == 0 && stat->ecm_count == 0) {
     469            stat->rc = 5;
     470            inc_fail(stat);
    469471        }
    470472               
    471473        stat->last_received = ctime;
    472474
    473         if (!cfg.lb_reopen_mode)
    474             stat->ecm_count /= 2;
    475        
    476475        //add timeout to stat:
    477476        if (ecm_time<=0 || ecm_time > (int)cfg.ctimeout)
  • trunk/oscam-garbage.c

    r5333 r5352  
    3737        while (cs_trylock(&garbage_lock[bucket])) {
    3838            cs_debug_mask(D_TRACE, "trylock add_garbage wait");
    39             cs_sleepms(50);
     39            cs_sleepms(fast_rnd());
    4040        }
    4141       
     
    8080                    while (cs_trylock(&garbage_lock[i])) {
    8181                        cs_debug_mask(D_TRACE, "trylock garbage_collector wait");
    82                         cs_sleepms(50);
     82                        cs_sleepms(fast_rnd());
    8383                    }
    8484                    now = time(NULL);
Note: See TracChangeset for help on using the changeset viewer.