Changeset 2035
- Timestamp:
- 04/09/10 22:57:53 (14 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-dvbapi.c
r2020 r2035 710 710 //int demux_index=buffer[7+k]; 711 711 //dvbapi_stop_descrambling_all(demux_index); 712 close(connfd);713 712 break; 714 713 default: … … 918 917 chk_pending(tp); 919 918 920 cs_debug_mask(D_FUT, "dvbapi: collect devices");921 922 919 for (i=0;i<MAX_DEMUX;i++) { 923 920 for (g=0;g<MAX_FILTER;g++) { … … 942 939 943 940 if (rc<1) continue; 944 cs_debug_mask(D_FUT, "dvbapi: got event %d", rc);945 941 946 942 for (i = 0; i < pfdcount; i++) { -
trunk/oscam.c
r2032 r2035 2253 2253 } 2254 2254 2255 static void build_delay(struct timeb *tpe, struct timeb *tpc)2256 {2257 if (comp_timeb(tpe, tpc)>0)2258 {2259 tpe->time=tpc->time;2260 tpe->millitm=tpc->millitm;2261 }2262 }2263 2264 2255 struct timeval *chk_pending(struct timeb tp_ctimeout) 2265 2256 { 2266 int i; 2267 ulong td; 2268 struct timeb tpn, tpe, tpc; // <n>ow, <e>nd, <c>heck 2269 static struct timeval tv; 2270 2271 ECM_REQUEST *er; 2272 cs_ftime(&tpn); 2273 tpe=tp_ctimeout; // latest delay -> disconnect 2274 2275 if (ecmtask) 2276 i=(ph[client[cs_idx].ctyp].multi)?CS_MAXPENDING:1; 2277 else 2278 i=0; 2279 //cs_log("num pend=%d", i); 2280 for (--i; i>=0; i--) 2281 if (ecmtask[i].rc>=100) // check all pending ecm-requests 2282 { 2283 int act, j; 2284 er=&ecmtask[i]; 2285 tpc=er->tps; 2286 tpc.millitm += (er->stage) ? cfg->ctimeout : cfg->ftimeout; 2287 tpc.time += tpc.millitm / 1000; 2288 tpc.millitm = tpc.millitm % 1000; 2289 if (!er->stage) 2290 { 2291 for (j=0, act=1; (act) && (j<CS_MAXREADER); j++) 2292 { 2293 if (cfg->preferlocalcards && !er->locals_done) 2294 { 2295 if ((er->reader[j]&1) && !(reader[j].typ & R_IS_NETWORK)) 2296 act=0; 2297 } 2298 else if (cfg->preferlocalcards && er->locals_done) 2299 { 2300 if ((er->reader[j]&1) && (reader[j].typ & R_IS_NETWORK)) 2301 act=0; 2302 } 2303 else 2304 { 2305 if (er->reader[j]&1) 2306 act=0; 2307 } 2308 } 2309 //cs_log("stage 0, act=%d r0=%d, r1=%d, r2=%d, r3=%d, r4=%d r5=%d", act, 2310 // er->reader[0], er->reader[1], er->reader[2], 2311 // er->reader[3], er->reader[4], er->reader[5]); 2312 if (act) 2313 { 2314 int inc_stage = 1; 2315 2316 if (cfg->preferlocalcards && !er->locals_done) 2317 { 2318 int i; 2319 2320 er->locals_done = 1; 2321 for (i = 0; i < CS_MAXREADER; i++) 2322 { 2323 if (reader[i].typ & R_IS_NETWORK) 2324 { 2325 inc_stage = 0; 2326 } 2327 } 2328 } 2329 if (!inc_stage) 2330 { 2331 request_cw(er, er->stage, 2); 2332 tpc.millitm += 1000 * (tpn.time - er->tps.time) + tpn.millitm - er->tps.millitm; 2333 tpc.time += tpc.millitm / 1000; 2334 tpc.millitm = tpc.millitm % 1000; 2335 } 2336 else 2337 { 2338 er->locals_done = 0; 2339 er->stage++; 2340 request_cw(er, er->stage, cfg->preferlocalcards ? 1 : 0); 2341 2342 tpc.millitm += (cfg->ctimeout-cfg->ftimeout); 2343 tpc.time += tpc.millitm / 1000; 2344 tpc.millitm = tpc.millitm % 1000; 2345 } 2346 } 2347 } 2348 if (comp_timeb(&tpn, &tpc)>0) // action needed 2349 { 2350 //cs_log("Action now %d.%03d", tpn.time, tpn.millitm); 2351 //cs_log(" %d.%03d", tpc.time, tpc.millitm); 2352 if (er->stage) 2353 { 2354 er->rc=5; // timeout 2355 send_dcw(er); 2356 continue; 2357 } 2358 else 2359 { 2360 er->stage++; 2361 request_cw(er, er->stage, 0); 2362 tpc.millitm += (cfg->ctimeout-cfg->ftimeout); 2363 tpc.time += tpc.millitm / 1000; 2364 tpc.millitm = tpc.millitm % 1000; 2365 } 2366 } 2367 build_delay(&tpe, &tpc); 2368 } 2369 td=(tpe.time-tpn.time)*1000+(tpe.millitm-tpn.millitm)+5; 2370 tv.tv_sec = td/1000; 2371 tv.tv_usec = (td%1000)*1000; 2372 //cs_log("delay %d.%06d", tv.tv_sec, tv.tv_usec); 2373 return(&tv); 2257 int i; 2258 ulong td; 2259 struct timeb tpn, tpe, tpc; // <n>ow, <e>nd, <c>heck 2260 static struct timeval tv; 2261 2262 ECM_REQUEST *er; 2263 cs_ftime(&tpn); 2264 tpe=tp_ctimeout; // latest delay -> disconnect 2265 2266 if (ecmtask) 2267 i=(ph[client[cs_idx].ctyp].multi)?CS_MAXPENDING:1; 2268 else 2269 i=0; 2270 2271 //cs_log("num pend=%d", i); 2272 2273 for (--i; i>=0; i--) { 2274 if (ecmtask[i].rc>=100) { // check all pending ecm-requests 2275 int act, j; 2276 er=&ecmtask[i]; 2277 tpc=er->tps; 2278 tpc.millitm += (er->stage) ? cfg->ctimeout : cfg->ftimeout; 2279 tpc.time += tpc.millitm / 1000; 2280 tpc.millitm = tpc.millitm % 1000; 2281 if (!er->stage) { 2282 for (j=0, act=1; (act) && (j<CS_MAXREADER); j++) { 2283 if (cfg->preferlocalcards && !er->locals_done) { 2284 if ((er->reader[j]&1) && !(reader[j].typ & R_IS_NETWORK)) 2285 act=0; 2286 } else if (cfg->preferlocalcards && er->locals_done) { 2287 if ((er->reader[j]&1) && (reader[j].typ & R_IS_NETWORK)) 2288 act=0; 2289 } else { 2290 if (er->reader[j]&1) 2291 act=0; 2292 } 2293 } 2294 2295 //cs_log("stage 0, act=%d r0=%d, r1=%d, r2=%d, r3=%d, r4=%d r5=%d", act, 2296 // er->reader[0], er->reader[1], er->reader[2], 2297 // er->reader[3], er->reader[4], er->reader[5]); 2298 2299 if (act) { 2300 int inc_stage = 1; 2301 if (cfg->preferlocalcards && !er->locals_done) { 2302 cs_log("loop %d - %d:%d", i, cfg->preferlocalcards, er->locals_done); 2303 er->locals_done = 1; 2304 for (j = 0; j < CS_MAXREADER; j++) { 2305 if (reader[j].typ & R_IS_NETWORK) 2306 inc_stage = 0; 2307 } 2308 } 2309 if (!inc_stage) { 2310 request_cw(er, er->stage, 2); 2311 tpc.millitm += 1000 * (tpn.time - er->tps.time) + tpn.millitm - er->tps.millitm; 2312 tpc.time += tpc.millitm / 1000; 2313 tpc.millitm = tpc.millitm % 1000; 2314 } else { 2315 er->locals_done = 0; 2316 er->stage++; 2317 request_cw(er, er->stage, cfg->preferlocalcards ? 1 : 0); 2318 2319 tpc.millitm += (cfg->ctimeout-cfg->ftimeout); 2320 tpc.time += tpc.millitm / 1000; 2321 tpc.millitm = tpc.millitm % 1000; 2322 } 2323 } 2324 } 2325 if (comp_timeb(&tpn, &tpc)>0) { // action needed 2326 //cs_log("Action now %d.%03d", tpn.time, tpn.millitm); 2327 //cs_log(" %d.%03d", tpc.time, tpc.millitm); 2328 if (er->stage) { 2329 er->rc=5; // timeout 2330 send_dcw(er); 2331 continue; 2332 } else { 2333 er->stage++; 2334 request_cw(er, er->stage, 0); 2335 tpc.millitm += (cfg->ctimeout-cfg->ftimeout); 2336 tpc.time += tpc.millitm / 1000; 2337 tpc.millitm = tpc.millitm % 1000; 2338 } 2339 } 2340 //build_delay(&tpe, &tpc); 2341 if (comp_timeb(&tpe, &tpc)>0) { 2342 tpe.time=tpc.time; 2343 tpe.millitm=tpc.millitm; 2344 } 2345 } 2346 } 2347 2348 td=(tpe.time-tpn.time)*1000+(tpe.millitm-tpn.millitm)+5; 2349 tv.tv_sec = td/1000; 2350 tv.tv_usec = (td%1000)*1000; 2351 //cs_log("delay %d.%06d", tv.tv_sec, tv.tv_usec); 2352 return(&tv); 2374 2353 } 2375 2354 -
trunk/reader-common.c
r2032 r2035 312 312 int i; 313 313 for( i=1; i<CS_MAXPID; i++ ) { 314 if( client[i].pid && client[i].typ=='c' && client[i].usr[0] ) {314 if( client[i].pid && client[i].typ=='c' && client[i].usr[0] && ph[client[i].ctyp].type & MOD_CONN_NET) { 315 315 kill(client[i].pid, SIGQUIT); 316 316 }
Note:
See TracChangeset
for help on using the changeset viewer.