diff options
-rw-r--r-- | HISTORY.h | 7 | ||||
-rw-r--r-- | update.c | 80 |
2 files changed, 55 insertions, 32 deletions
@@ -5,8 +5,8 @@ * */ -#define _VERSION "1.1.63" -#define VERSION_DATE "08.06.2017" +#define _VERSION "1.1.64" +#define VERSION_DATE "09.06.2017" #define DB_API 4 @@ -19,6 +19,9 @@ /* * ------------------------------------ +2017-06-09: version 1.1.64 (horchi) + - Bugfix: Fixed lock sequence + 2017-06-08 version 1.1.63 (horchi) - change: Improved aux field - change: Suppress inactive timers on service interface @@ -1359,41 +1359,41 @@ void clearEpg() #endif } -//*************************************************************************** -// Get Schedule Of -//*************************************************************************** +// //*************************************************************************** +// // Get Schedule Of +// //*************************************************************************** -int getScheduleOf(tChannelID channelId, const cSchedules* schedules, cSchedule*& s) -{ - cChannel* channel = 0; +// int getScheduleOf(tChannelID channelId, const cSchedules* schedules, cSchedule*& s) +// { +// cChannel* channel = 0; - s = 0; +// s = 0; - // get channels lock +// // get channels lock -#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) - cStateKey channelsKey; - cChannels* channels = cChannels::GetChannelsWrite(channelsKey, 500); -#else - cChannels* channels = &Channels; -#endif +// #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) +// cStateKey channelsKey; +// cChannels* channels = cChannels::GetChannelsWrite(channelsKey, 500); +// #else +// cChannels* channels = &Channels; +// #endif - if (!channels) - return fail; +// if (!channels) +// return fail; - // get channel and schedule of channel +// // get channel and schedule of channel - if (channel = channels->GetByChannelID(channelId, true)) - s = (cSchedule*)schedules->GetSchedule(channel, true); - else - tell(0, "Error: Channel with ID '%s' don't exist on this VDR", (const char*)channelId.ToString()); +// if (channel = channels->GetByChannelID(channelId, true)) +// s = (cSchedule*)schedules->GetSchedule(channel, true); +// else +// tell(0, "Error: Channel with ID '%s' don't exist on this VDR", (const char*)channelId.ToString()); -#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) - channelsKey.Remove(); -#endif +// #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) +// channelsKey.Remove(); +// #endif - return success; -} +// return success; +// } //*************************************************************************** // Refresh Epg @@ -1454,6 +1454,7 @@ int cUpdate::refreshEpg(const char* forChannelId, int maxTries) { int count = 0; cSchedule* s = 0; + cChannel* channel = 0; tChannelID channelId = tChannelID::FromString(mapDb->getStrValue("ChannelId")); channels++; @@ -1462,7 +1463,7 @@ int cUpdate::refreshEpg(const char* forChannelId, int maxTries) eventsDb->setValue("UPDSP", forChannelId ? 0 : lastEventsUpdateAt); eventsDb->setValue("CHANNELID", mapDb->getStrValue("CHANNELID")); - // get timers lock + // #1 get timers lock #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) cStateKey timersKey; @@ -1472,7 +1473,16 @@ int cUpdate::refreshEpg(const char* forChannelId, int maxTries) cTimers* timers = &Timers; #endif - // get schedules lock + // #2 get channels lock + +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + cStateKey channelsKey; + cChannels* channels = cChannels::GetChannelsWrite(channelsKey, 500); +#else + cChannels* channels = &Channels; +#endif + + // #3 get schedules lock #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) cStateKey schedulesKey; @@ -1484,13 +1494,21 @@ int cUpdate::refreshEpg(const char* forChannelId, int maxTries) tell(3, "LOCK (refreshEpg)"); #endif - if (!schedules || !timers || getScheduleOf(channelId, schedules, s) != success) + // get channel and schedule of channel + + if (channel = channels->GetByChannelID(channelId, true)) + s = (cSchedule*)schedules->GetSchedule(channel, true); + else + tell(0, "Error: Channel with ID '%s' don't exist on this VDR", (const char*)channelId.ToString()); + + if (!schedules || !channels || !timers || !s) { - tell(3, "Info: Can't get write lock on '%s'", !schedules ? "schedules" : "timers"); + tell(3, "Info: Can't get write lock on '%s'", !schedules ? "schedules" : !timers ? "timers" : "channels"); #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) if (schedules) schedulesKey.Remove(); if (timers) timersKey.Remove(); + if (channels) channelsKey.Remove(); #else delete schedulesLock; #endif @@ -1592,6 +1610,8 @@ int cUpdate::refreshEpg(const char* forChannelId, int maxTries) #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) schedulesKey.Remove(); tell(3, "-> Released schedules lock"); + channelsKey.Remove(); + tell(3, "-> Released channels lock"); timersKey.Remove(); tell(3, "-> Released timers lock"); #else |