Changeset 3897
- Timestamp:
- 11/13/10 15:28:30 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-cccam.c
r3891 r3897 195 195 * clears and frees values for reinit 196 196 */ 197 void cc_cli_close(struct s_client *cl ) {197 void cc_cli_close(struct s_client *cl, int call_conclose) { 198 198 cs_debug_mask(D_FUT, "cc_cli_close in"); 199 199 struct s_reader *rdr = cl->reader; … … 206 206 rdr->last_s = rdr->last_g = 0; 207 207 208 if (cc && cc->mode == CCCAM_MODE_NORMAL )208 if (cc && cc->mode == CCCAM_MODE_NORMAL && call_conclose) 209 209 network_tcp_connection_close(cl, cl->udp_fd); 210 else { 211 if (cl->udp_fd) 212 close(cl->udp_fd); 213 cl->udp_fd = 0; 214 } 210 215 211 216 if (cc) { … … 417 422 cs_disconnect_client(cl); 418 423 else 419 cc_cli_close(cl );424 cc_cli_close(cl, TRUE); 420 425 } 421 426 … … 847 852 getprefix(), cfg->ctimeout * 4 / 1000); 848 853 //cc_cycle_connection(); 849 cc_cli_close(cl );854 cc_cli_close(cl, FALSE); 850 855 cs_debug_mask(D_FUT, "cc_send_ecm out"); 851 856 return 0; … … 1465 1470 struct cc_card *card; 1466 1471 while ((card = ll_iter_next(it))) { 1467 if (card == card_to_move) { //we aready have this card, delete it1472 if (card == card_to_move) { 1468 1473 ll_iter_remove(it); 1469 1474 break; … … 1593 1598 cc->cmd05_mode = MODE_UNKNOWN; 1594 1599 //cycle_connection(); //Absolute unknown handling! 1595 cc_cli_close(cl );1600 cc_cli_close(cl, FALSE); 1596 1601 // 1597 1602 //44 bytes: set aes128 key, Key=16 bytes [Offset=len(password)] … … 1843 1848 ecm_idx, cs_hexdump(0, cc->dcw, 16)); 1844 1849 add_good_sid(cl, card, &srvid); 1850 1851 //check response time, if > fallbacktime, switch cards! 1852 struct timeb tpe; 1853 cs_ftime(&tpe); 1854 ulong cwlastresptime = 1000*(tpe.time-cc->ecm_time.time)+tpe.millitm-cc->ecm_time.millitm; 1855 if (cwlastresptime > cfg->ftimeout) { 1856 cs_log("%s card %04X is too slow, moving to the end...", getprefix(), card->id); 1857 move_card_to_end(cl, card); 1858 } 1859 1845 1860 } 1846 1861 } else { … … 1973 1988 cc->max_ecms); 1974 1989 //cc_cycle_connection(); 1975 cc_cli_close(cl );1990 cc_cli_close(cl, FALSE); 1976 1991 //cc_send_ecm(NULL, NULL); 1977 1992 } … … 2105 2120 cs_disconnect_client(cl); 2106 2121 else 2107 cc_cli_close(cl );2122 cc_cli_close(cl, FALSE); 2108 2123 } 2109 2124 … … 3007 3022 // connect 3008 3023 handle = network_tcp_connection_open(); 3009 if (errno == EISCONN) {3010 cc_cli_close(cl);3011 return -1;3012 }3013 3024 if (handle <= 0) { 3014 3025 cs_log("%s network connect error!", rdr->label); … … 3231 3242 if (cc && cc->mode == CCCAM_MODE_SHUTDOWN) 3232 3243 return -1; 3244 3233 3245 while (!reader->tcp_connected && reader->cc_keepalive && cfg->reader_restart_seconds > 0) { 3246 3247 if (!reader->tcp_connected) { 3248 cc_cli_close(cl, FALSE); 3249 res = cc_cli_init_int(cl); 3250 if (res) 3251 return res; 3252 } 3234 3253 cs_log("%s restarting reader in %d seconds", reader->label, cfg->reader_restart_seconds); 3235 3254 cs_sleepms(cfg->reader_restart_seconds*1000); … … 3283 3302 3284 3303 if (cl->typ != 'c') { 3285 cc_cli_close(cl ); // we need to close open fd's3304 cc_cli_close(cl, FALSE); // we need to close open fd's 3286 3305 } 3287 3306 cc_free(cl);
Note:
See TracChangeset
for help on using the changeset viewer.