Changeset 4098


Ignore:
Timestamp:
12/12/10 22:59:18 (13 years ago)
Author:
schlocke
Message:

cccam: removed non-working preferred card, changed keepconnected mgcamd
compatibility

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/globals.h

    r4068 r4098  
    547547  ushort        idx;
    548548  ulong         prid;
    549   void          *preferred_card;
    550549  struct s_reader *selected_reader;
    551550  int           matching_rdr[CS_MAXREADER];
  • trunk/module-cccam.c

    r4097 r4098  
    412412        if (cl->ecmtask[i].idx == ecm_idx && cl->ecmtask[i].rc == 101)
    413413            cl->ecmtask[i].rc = 100; //Mark unused
    414             cl->ecmtask[i].preferred_card = NULL;
    415414    }
    416415}
     
    11041103
    11051104    pthread_mutex_lock(&cc->cards_busy);
    1106     if (cur_er->preferred_card &&
    1107         ((struct cc_card*)cur_er->preferred_card)->origin_reader == rdr) {
    1108             //card is defined by client, use this card!
    1109         it = ll_iter_create(cc->cards);
    1110         while ((card = ll_iter_next(it))) {
    1111             if (same_card(card, cur_er->preferred_card)) { //Found this card!
    1112                 if (!is_sid_blocked(card, &cur_srvid)) {
    1113                     cs_debug_mask(D_TRACE, "%s found preferred card %d", getprefix(), card->id);
    1114                     break;
    1115                 }
    1116             }
    1117         }
    1118         ll_iter_release(it);
    1119     }
    1120     else card = NULL;
    1121    
    1122     if (!card) {
    1123         //search cache:
    1124         current_card = cc_find_current_card_by_srvid(cc, cur_er->caid,
    1125             cur_er->prid, &cur_srvid);
    1126         if (current_card) {
    1127             if (!current_card->card || is_sid_blocked(current_card->card,
    1128                 &cur_srvid)) {
    1129                 cc_remove_current_card(cc, current_card);
    1130                 current_card = NULL;
    1131             }
    1132         }
    1133         if (current_card)
    1134             card = current_card->card;
    1135         else
    1136             card = NULL;
    1137     }
     1105    //search cache:
     1106    current_card = cc_find_current_card_by_srvid(cc, cur_er->caid,
     1107        cur_er->prid, &cur_srvid);
     1108    if (current_card) {
     1109        if (!current_card->card || is_sid_blocked(current_card->card,
     1110            &cur_srvid)) {
     1111            cc_remove_current_card(cc, current_card);
     1112            current_card = NULL;
     1113        }
     1114    }
     1115    if (current_card)
     1116        card = current_card->card;
     1117    else
     1118        card = NULL;
    11381119   
    11391120    //then check all other cards
     
    22072188                er->idx = ++cc->server_ecm_idx;
    22082189               
    2209                 er->preferred_card = cc_get_card_by_id(server_card->id, cc->reported_carddatas);
    2210 
    22112190                cs_debug_mask(
    22122191                        D_TRACE,
     
    33683347
    33693348    cmi = 0;
    3370     wait_for_keepalive = 0;
     3349    wait_for_keepalive = 100;
     3350    //some clients, e.g. mgcamd, does not support keepalive. So if not answered, keep connection
    33713351    // check for client timeout, if timeout occurs try to send keepalive
    33723352    while (cl->pfd)
     
    33763356            cmi += 10;
    33773357            if (cmi >= cfg->cmaxidle) {
    3378                 cmi = 0;
    33793358                if (cfg->cc_keep_connected) {
    3380                     if (!wait_for_keepalive) {
     3359                    if (wait_for_keepalive<3 || wait_for_keepalive == 100) {
    33813360                        if (cc_cmd_send(cl, NULL, 0, MSG_KEEPALIVE) < 0)
    33823361                            break;
    33833362                                    cs_debug("cccam: keepalive");
    33843363                                    cc->answer_on_keepalive = time(NULL);
    3385                                     wait_for_keepalive = 1;
     3364                                    wait_for_keepalive++;
    33863365                    }
    3387                                 continue;
     3366                    else if (wait_for_keepalive<100) break;
    33883367                } else {
    33893368                    cs_debug_mask(D_TRACE, "%s keepalive after maxidle is reached",
     
    33973376        else { //data is parsed!
    33983377            cmi = 0;
    3399             wait_for_keepalive = 0;
     3378            if (i == MSG_KEEPALIVE)
     3379                wait_for_keepalive = 0;
    34003380        }
    34013381        if (cc->mode != CCCAM_MODE_NORMAL || cl->dup)
  • trunk/module-stat.c

    r4069 r4098  
    318318        if (er->matching_rdr[i]) {
    319319            int weight = rdr->lb_weight <= 0?100:rdr->lb_weight;
    320             if (er->preferred_card && ((struct cc_card*)(er->preferred_card))->origin_reader==rdr)
    321                 weight*=2;
    322320               
    323321            stat = get_stat(rdr, er->caid, er->prid, er->srvid);
Note: See TracChangeset for help on using the changeset viewer.