summaryrefslogtreecommitdiff
path: root/eit.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-03-14 10:41:48 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-03-14 10:41:48 +0100
commitc8b0ee3289849ab0d5778c58d65771f5c0270314 (patch)
tree2a428181996acf5c36e0e38917938f47fcdb91b9 /eit.c
parentcd676fda36688c2a125965501732e92afad3fa50 (diff)
downloadvdr-c8b0ee3289849ab0d5778c58d65771f5c0270314.tar.gz
vdr-c8b0ee3289849ab0d5778c58d65771f5c0270314.tar.bz2
Added missing channel locking to cEIT
Diffstat (limited to 'eit.c')
-rw-r--r--eit.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/eit.c b/eit.c
index 1b8c84c4..cf64e89f 100644
--- a/eit.c
+++ b/eit.c
@@ -8,7 +8,7 @@
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
* Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>.
*
- * $Id: eit.c 2.15 2012/03/10 14:43:52 kls Exp $
+ * $Id: eit.c 2.16 2012/03/14 10:11:15 kls Exp $
*/
#include "eit.h"
@@ -32,12 +32,18 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bo
if (!CheckCRCAndParse())
return;
+ time_t Now = time(NULL);
+ if (Now < VALID_TIME)
+ return; // we need the current time for handling PDC descriptors
+
+ if (!Channels.Lock(false, 10))
+ return;
tChannelID channelID(Source, getOriginalNetworkId(), getTransportStreamId(), getServiceId());
cChannel *channel = Channels.GetByChannelID(channelID, true);
- if (!channel)
- return; // only collect data for known channels
- if (EpgHandlers.IgnoreChannel(channel))
+ if (!channel || EpgHandlers.IgnoreChannel(channel)) {
+ Channels.Unlock();
return;
+ }
cSchedule *pSchedule = (cSchedule *)Schedules->GetSchedule(channel, true);
@@ -45,13 +51,9 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bo
bool Modified = false;
time_t SegmentStart = 0;
time_t SegmentEnd = 0;
- time_t Now = time(NULL);
struct tm tm_r;
struct tm t = *localtime_r(&Now, &tm_r); // this initializes the time zone in 't'
- if (Now < VALID_TIME)
- return; // we need the current time for handling PDC descriptors
-
SI::EIT::Event SiEitEvent;
for (SI::Loop::Iterator it; eventLoop.getNext(SiEitEvent, it); ) {
if (EpgHandlers.HandleEitEvent(pSchedule, &SiEitEvent, Tid, getVersionNumber()))
@@ -295,13 +297,12 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bo
pSchedule->ClrRunningStatus(channel);
pSchedule->SetPresentSeen();
}
- if (OnlyRunningStatus)
- return;
- if (Modified) {
+ if (Modified && !OnlyRunningStatus) {
EpgHandlers.SortSchedule(pSchedule);
EpgHandlers.DropOutdated(pSchedule, SegmentStart, SegmentEnd, Tid, getVersionNumber());
Schedules->SetModified(pSchedule);
}
+ Channels.Unlock();
}
// --- cTDT ------------------------------------------------------------------