mux, caid, caid, pid, pid, valid);
pthread_mutex_lock(&cwc_mutex);
TAILQ_FOREACH(cwc, &cwcs, cwc_link) {
- if (cwc->cwc_running) {
+ if (valid < 0 || cwc->cwc_running) {
LIST_FOREACH(pcard, &cwc->cwc_cards, cs_card) {
- if (pcard->cwc_caid == caid) {
+ if (valid < 0 || pcard->cwc_caid == caid) {
if (pcard->cwc_mux && pcard->cwc_mux != mux) continue;
- if (valid) {
+ if (valid > 0) {
pcard->cwc = cwc;
pcard->cwc_mux = mux;
descrambler_open_emm(mux, pcard, caid, cwc_emm);
if (mux == NULL)
return;
tvhtrace("descrambler", "mux %p - flush tables", mux);
+#if ENABLE_CWC
+ cwc_caid_update(mux, 0, 0, -1);
+#endif
pthread_mutex_lock(&mux->mm_descrambler_lock);
while ((dt = TAILQ_FIRST(&mux->mm_descrambler_tables)) != NULL) {
while ((ds = TAILQ_FIRST(&dt->sections)) != NULL) {