ci-change-service-bug (thx DboxOldie)

Origin commit data
------------------
Branch: master
Commit: 72f27a8fe5
Author: max_10 <max_10@gmx.de>
Date: 2016-08-11 (Thu, 11 Aug 2016)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
max_10
2016-08-11 20:49:23 +02:00
parent 7d94090b42
commit 7d198a8394
2 changed files with 43 additions and 21 deletions

View File

@@ -682,6 +682,11 @@ SlotIt cCA::FindFreeSlot(u64 TP, u8 source, u16 SID, ca_map_t camap, unsigned ch
if ((*it)->TP == TP && (*it)->SID[j] == SID && (*it)->source == source)
return it;
}
}
for (it = slot_data.begin(); it != slot_data.end(); ++it)
{
if (!scrambled) { continue; }
if ((*it)->multi && (*it)->TP == TP && (*it)->source == source && (*it)->ci_use_count < CI_MAX_MULTI)
return it;
@@ -691,16 +696,31 @@ SlotIt cCA::FindFreeSlot(u64 TP, u8 source, u16 SID, ca_map_t camap, unsigned ch
{
if (!scrambled) { continue; }
bool recordUse_found = false;
bool liveUse_found = false;
int found_count = 0;
if ((*it)->bsids.size())
{
for (i = 0; i < (*it)->bsids.size(); i++)
if ((*it)->bsids[i] == SID) {goto OUT;}
if ((*it)->bsids[i] == SID) {(*it)->SidBlackListed = true; break;}
if (i == (*it)->bsids.size()) {(*it)->SidBlackListed = false;}
}
if ((*it)->camIsReady && (*it)->hasCAManager && (*it)->hasAppManager && !(*it)->recordUse[0])
for (int j = 0; j < CI_MAX_MULTI; j++)
{
if (!checkLiveSlot || (!(*it)->liveUse[0] || ((*it)->liveUse[0] && (*it)->TP == TP && (*it)->SID[0] == SID)))
if ((*it)->recordUse[j])
recordUse_found = true;
if ((*it)->liveUse[j])
{
liveUse_found = true;
found_count = j;
}
}
if ((*it)->camIsReady && (*it)->hasCAManager && (*it)->hasAppManager && !recordUse_found)
{
if (!checkLiveSlot || (!liveUse_found || ((*it)->liveUse[found_count] && (*it)->TP == TP && (*it)->SID[found_count] == SID)))
{
#if x_debug
printf("Slot Caids: %d > ", (*it)->cam_caids.size());
@@ -708,25 +728,24 @@ SlotIt cCA::FindFreeSlot(u64 TP, u8 source, u16 SID, ca_map_t camap, unsigned ch
printf("%04x ", (*it)->cam_caids[i]);
printf("\n");
#endif
(*it)->scrambled = scrambled;
for (i = 0; i < (*it)->cam_caids.size(); i++)
{
caIt = camap.find((*it)->cam_caids[i]);
if (caIt != camap.end())
{
printf("Found: %04x\n", *caIt);
(*it)->scrambled = scrambled;
return it;
}
else
{
printf("Not Found\n");
(*it)->scrambled = 0;
return it;
}
}
}
}
OUT:
usleep(0);
}
return it;
}
@@ -839,6 +858,8 @@ bool cCA::SendCAPMT(u64 tpid, u8 source, u8 camask, const unsigned char * cabuf,
} else if ((*It)->ccmgr_ready && (*It)->hasCCManager && (*It)->scrambled && !(*It)->SidBlackListed)
(*It)->ccmgrSession->resendKey((tSlot*)(*It));
if ((*It)->scrambled && !(*It)->SidBlackListed)
{
for (int j = 0; j < CI_MAX_MULTI; j++)
{
if (enabled && (*It)->SID[j] == SID)
@@ -854,6 +875,7 @@ bool cCA::SendCAPMT(u64 tpid, u8 source, u8 camask, const unsigned char * cabuf,
}
}
}
}
else
{
printf("No free ci-slot\n");
@@ -959,10 +981,10 @@ static cCA* pcCAInstance = NULL;
cCA * cCA::GetInstance()
{
printf("%s -> %s\n", FILENAME, __FUNCTION__);
if (pcCAInstance == NULL)
{
printf("%s -> %s\n", FILENAME, __FUNCTION__);
hw_caps_t *caps = get_hwcaps();
pcCAInstance = new cCA(caps->has_CI);
}
@@ -1301,11 +1323,11 @@ void cCA::slot_pollthread(void *c)
/* not necessary: the arrived capmt will be automaticly send */
//SendCaPMT(slot);
}
if (slot->hasCAManager && slot->hasAppManager && slot->newCapmt && !slot->SidBlackListed)
if (slot->hasCAManager && slot->hasAppManager && slot->newCapmt)
{
SendCaPMT(slot);
slot->newCapmt = false;
if (slot->ccmgr_ready && slot->hasCCManager && slot->scrambled)
if (slot->ccmgr_ready && slot->hasCCManager && slot->scrambled && !slot->SidBlackListed)
slot->ccmgrSession->resendKey(slot);
}
}
@@ -1411,7 +1433,7 @@ bool cCA::checkChannelID(u64 chanID)
{
for (int j = 0; j < CI_MAX_MULTI; j++)
{
if ((*it)->TP == TP && (*it)->SID[j] == SID && !(*it)->SidBlackListed)
if ((*it)->TP == TP && (*it)->SID[j] == SID && !(*it)->SidBlackListed && (*it)->scrambled)
return true;
}
}

View File

@@ -27,7 +27,7 @@
#define T_DATA_MORE 0xA1 // convey data from higher constructed h<->m
/* max multi decrypt per ci-cam */
#define CI_MAX_MULTI 4
#define CI_MAX_MULTI 5
enum CA_INIT_MASK {
CA_INIT_SC = 1,