Changeset 4813 for trunk/module-cccam.c
- Timestamp:
- 03/15/11 22:03:46 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-cccam.c
r4808 r4813 662 662 */ 663 663 int cc_get_nxt_ecm(struct s_client *cl) { 664 struct cc_data *cc = cl->cc; 665 ECM_REQUEST *er, *ern; 664 666 int n, i; 665 667 time_t t; … … 668 670 n = -1; 669 671 for (i = 0; i < CS_MAXPENDING; i++) { 670 if ((t - (ulong) cl->ecmtask[i].tps.time > ((cfg.ctimeout + 500) 671 / 1000) + 1) && (cl->ecmtask[i].rc >= 10)) // drop timeouts 672 er = &cl->ecmtask[i]; 673 if ((t - (ulong) er->tps.time > ((cfg.ctimeout + 500) 674 / 1000) + 1) && (er->rc >= 10)) // drop timeouts 672 675 { 673 cl->ecmtask[i].rc = 0; 674 } 675 676 if (cl->ecmtask[i].rc >= 10 && cl->ecmtask[i].rc != 101) { // stil active and waiting 676 er->rc = 0; 677 } 678 679 else if (er->rc >= 10 && er->rc != 101) { // stil active and waiting 680 if (!memcmp(er->origin_node_id, cc->peer_node_id, sizeof(cc->peer_node_id))) { // same nodeid? ignore 681 er->rc = E_RDR_NOTFOUND; 682 er->rcEx = E2_CCCAM_LOOP; 683 cs_debug_mask(D_READER, "%s ecm loop detected! client %s (%s)", 684 getprefix(), er->client->account->usr, er->client->thread); 685 write_ecm_answer(cl->reader, &cl->ecmtask[i]); 686 } 687 else 677 688 // search for the ecm with the lowest time, this should be the next to go 678 if (n < 0 || cl->ecmtask[n].tps.time - cl->ecmtask[i].tps.time < 0) {689 if (n < 0 || (ern->tps.time - er->tps.time < 0)) { 679 690 680 691 //check for already pending: 681 if ( ((struct cc_data*)cl->cc)->extended_mode) {692 if (cc->extended_mode) { 682 693 int j,found; 694 ECM_REQUEST *erx; 683 695 for (found=j=0;j<CS_MAXPENDING;j++) { 684 if (i!=j && cl->ecmtask[j].rc == 101 && 685 cl->ecmtask[i].caid==cl->ecmtask[j].caid && 686 cl->ecmtask[i].ecmd5==cl->ecmtask[j].ecmd5) { 687 found=1; 688 break; 696 erx = &cl->ecmtask[j]; 697 if (i!=j && erx->rc == 101 && 698 er->caid==erx->caid && 699 er->ecmd5==erx->ecmd5) { 700 found=1; 701 break; 689 702 } 690 703 } 691 if (!found) 704 if (!found) { 692 705 n = i; 706 ern = er; 707 } 693 708 } 694 else 709 else { 695 710 n = i; 711 ern = er; 712 } 696 713 } 697 714 } … … 1978 1995 cc->server_ecm_pending++; 1979 1996 er->idx = ++cc->server_ecm_idx; 1997 memcpy(er->origin_node_id, cc->peer_node_id, sizeof(cc->peer_node_id)); 1980 1998 1981 1999 if (cfg.cc_forward_origin_card) { //search my shares for this card:
Note:
See TracChangeset
for help on using the changeset viewer.