mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
eitd/sectionsd.cpp: check myCurrentEvent for expire before using it
This commit is contained in:
@@ -2306,6 +2306,24 @@ void CEitManager::getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEve
|
|||||||
unlockEvents();
|
unlockEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* invalidate current/next events, if current event times expired */
|
||||||
|
void CEitManager::checkCurrentNextEvent(void)
|
||||||
|
{
|
||||||
|
time_t curtime = time(NULL);
|
||||||
|
writeLockEvents();
|
||||||
|
if (scanning || !myCurrentEvent || myCurrentEvent->times.empty()) {
|
||||||
|
unlockEvents();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((long)(myCurrentEvent->times.begin()->startzeit + myCurrentEvent->times.begin()->dauer) < (long)curtime) {
|
||||||
|
delete myCurrentEvent;
|
||||||
|
myCurrentEvent = NULL;
|
||||||
|
delete myNextEvent;
|
||||||
|
myNextEvent = NULL;
|
||||||
|
}
|
||||||
|
unlockEvents();
|
||||||
|
}
|
||||||
|
|
||||||
/* send back the current and next event for the channel id passed to it
|
/* send back the current and next event for the channel id passed to it
|
||||||
* Works like that:
|
* Works like that:
|
||||||
* - if the currently running program is requested, return myCurrentEvent and myNextEvent,
|
* - if the currently running program is requested, return myCurrentEvent and myNextEvent,
|
||||||
@@ -2329,6 +2347,8 @@ void CEitManager::getCurrentNextServiceKey(t_channel_id uniqueServiceKey, CSecti
|
|||||||
|
|
||||||
uniqueServiceKey &= 0xFFFFFFFFFFFFULL;
|
uniqueServiceKey &= 0xFFFFFFFFFFFFULL;
|
||||||
|
|
||||||
|
checkCurrentNextEvent();
|
||||||
|
|
||||||
readLockEvents();
|
readLockEvents();
|
||||||
/* if the currently running program is requested... */
|
/* if the currently running program is requested... */
|
||||||
if (uniqueServiceKey == messaging_current_servicekey) {
|
if (uniqueServiceKey == messaging_current_servicekey) {
|
||||||
@@ -2587,6 +2607,7 @@ bool CEitManager::getActualEPGServiceKey(const t_channel_id channel_id, CEPGData
|
|||||||
dprintf("[commandActualEPGchannelID] Request of current EPG for " PRINTF_CHANNEL_ID_TYPE "\n", channel_id);
|
dprintf("[commandActualEPGchannelID] Request of current EPG for " PRINTF_CHANNEL_ID_TYPE "\n", channel_id);
|
||||||
|
|
||||||
t_channel_id uniqueServiceKey = channel_id & 0xFFFFFFFFFFFFULL;
|
t_channel_id uniqueServiceKey = channel_id & 0xFFFFFFFFFFFFULL;
|
||||||
|
checkCurrentNextEvent();
|
||||||
readLockEvents();
|
readLockEvents();
|
||||||
if (uniqueServiceKey == messaging_current_servicekey) {
|
if (uniqueServiceKey == messaging_current_servicekey) {
|
||||||
if (myCurrentEvent) {
|
if (myCurrentEvent) {
|
||||||
|
@@ -42,6 +42,7 @@ class CEitManager : public OpenThreads::Thread, public OpenThreads::Mutex
|
|||||||
|
|
||||||
static OpenThreads::Mutex m;
|
static OpenThreads::Mutex m;
|
||||||
static CEitManager * manager;
|
static CEitManager * manager;
|
||||||
|
void checkCurrentNextEvent(void);
|
||||||
|
|
||||||
CEitManager();
|
CEitManager();
|
||||||
/* main thread function */
|
/* main thread function */
|
||||||
|
Reference in New Issue
Block a user