From 7e30f7b7c80d41883ec9b0187dc9c47b6765a4d1 Mon Sep 17 00:00:00 2001 From: Dimitar Petrovski Date: Sat, 11 Aug 2018 14:27:23 +0200 Subject: fix wrong lock sequence thanks to Matthias Feistel --- README | 1 + eepg.c | 11 +++++++---- eit2.c | 6 ++---- eit2.h | 3 ++- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README b/README index c043a25..4e9dd9d 100644 --- a/README +++ b/README @@ -127,6 +127,7 @@ Thanks to mrgandalf, and the others who helped map NA eit. Thanks to VDR User for testing and providing makequiv.sh script for S72.7W channels. Thanks to cheesemonster for providing a patch to fix multipe device problems Thanks to Tony Houghton and Stuart Morris for testing Freeview HD +Thanks to Matthias Feistel for the wrong lock sequence fix We wish to thank all authors for the great work they have been doing, decoding this EEPG data; this plugin tries to combine the best of all worlds. diff --git a/eepg.c b/eepg.c index afab8bc..b829d10 100644 --- a/eepg.c +++ b/eepg.c @@ -2918,6 +2918,7 @@ void cFilterEEPG::ProccessContinuous(u_short Pid, u_char Tid, int Length, const //0x39 Viasat, 0x0300 Dish Network EEPG, 0x0441 Bell ExpressVU EEPG LogD(4, prep("Pid: 0x%02x Tid: %d Length: %d"), Pid, Tid, Length); #if APIVERSNUM >= 20300 + LOCK_CHANNELS_WRITE; LOCK_SCHEDULES_WRITE; // cStateKey SchedulesStateKey; // cSchedules *Schedules = cSchedules::GetSchedulesWrite(SchedulesStateKey, 10); @@ -2926,8 +2927,8 @@ void cFilterEEPG::ProccessContinuous(u_short Pid, u_char Tid, int Length, const cSchedules *Schedules = (cSchedules*)(cSchedules::Schedules(SchedulesLock)); #endif //Look for other satelite positions only if Dish/Bell ExpressVU for the moment hardcoded pid check - if(Schedules) - SI::cEIT2 EIT(Schedules, Source(), Tid, Data, Format, Pid == EIT_PID); + if(Channels && Schedules) + SI::cEIT2 EIT(Channels, Schedules, Source(), Tid, Data, Format, Pid == EIT_PID); #if APIVERSNUM < 20300 else//cEIT EIT (Schedules, Source (), Tid, Data); @@ -2936,10 +2937,12 @@ void cFilterEEPG::ProccessContinuous(u_short Pid, u_char Tid, int Length, const // that we can set the running status and 'seen' timestamp (well, actually // with a read lock we shouldn't be doing that, but it's only integers that // get changed, so it should be ok) + cChannelsLock ChannelsLock; + cChannels *Channels = (cSchedules*)(cSchedules::Schedules(SchedulesLock)); cSchedulesLock SchedulesLock; cSchedules *Schedules = (cSchedules*)(cSchedules::Schedules(SchedulesLock)); - if(Schedules) - SI::cEIT2 EIT(Schedules, Source(), Tid, Data, Format, Pid == EIT_PID, true); + if(Channels && Schedules) + SI::cEIT2 EIT(Channels, Schedules, Source(), Tid, Data, Format, Pid == EIT_PID, true); //cEIT EIT (Schedules, Source (), Tid, Data, true); } diff --git a/eit2.c b/eit2.c index 63f6187..a8b0561 100644 --- a/eit2.c +++ b/eit2.c @@ -118,8 +118,6 @@ void cEIT2::ProcessEventDescriptors(bool ExternalData, int Source, cComponents *Components = NULL; #if APIVERSNUM >= 20300 - LOCK_CHANNELS_WRITE; - if (!Channels) return; cChannel *channel = Channels->GetByChannelID(channelId); #else cChannel *channel = Channels.GetByChannelID(channelId); @@ -461,9 +459,10 @@ void cEIT2::ProcessEventDescriptors(bool ExternalData, int Source, channel->SetLinkChannels (LinkChannels); } -cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Data, EFormat format, bool isEITPid, bool OnlyRunningStatus) +cEIT2::cEIT2 (cChannels* Channels, cSchedules * Schedules, int Source, u_char Tid, const u_char * Data, EFormat format, bool isEITPid, bool OnlyRunningStatus) : SI::EIT (Data, false) , OnlyRunningStatus(OnlyRunningStatus) +, Channels(Channels) , Schedules(Schedules) , Format(format) { @@ -575,7 +574,6 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat // ETR 211: an empty entry in section 0 of table 0x4E means there is currently no event running { #if APIVERSNUM >= 20300 - LOCK_CHANNELS_WRITE; cChannel *chan = Channels->GetByChannelID(channel->GetChannelID()); #else cChannel *chan = Channels.GetByChannelID(channel->GetChannelID()); diff --git a/eit2.h b/eit2.h index b9e6298..65d4b82 100644 --- a/eit2.h +++ b/eit2.h @@ -51,7 +51,7 @@ extern bool SystemCharacterTableIsSingleByte;*/ class cEIT2:public SI::EIT { public: - cEIT2(cSchedules * Schedules, int Source, u_char Tid, const u_char * Data, + cEIT2(cChannels* Channels, cSchedules * Schedules, int Source, u_char Tid, const u_char * Data, EFormat format, bool isEITPid = false, bool OnlyRunningStatus = false); cEIT2 (cSchedule * Schedule, EFormat format); @@ -71,6 +71,7 @@ private: bool OnlyRunningStatus; time_t SegmentStart; time_t SegmentEnd; + cChannels* Channels; cSchedules* Schedules; EFormat Format; const cChannel* channel; -- cgit v1.2.3