mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-01 18:01:06 +02:00
zapit: fix deadlock after scan
Depending on various race conditions, the scan thread would
never terminate, or only after a connection timeout on the
zapit socket.
Fix by replacing CZapitClient calls with direct call of the
reloadchannels command sequence.
In general, using CZapitClient from within zapit seems not
to be a good idea and deadlock prone.
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1832 e54a6e83-5905-42d5-8d5c-058d10e6a962
Origin commit data
------------------
Commit: 4395d083d1
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2011-11-06 (Sun, 06 Nov 2011)
This commit is contained in:
@@ -492,7 +492,7 @@ bool CServiceScan::ScanProviders()
|
|||||||
int scan_sat_mode = mode & 0xFF00; // single = 0, all = 1
|
int scan_sat_mode = mode & 0xFF00; // single = 0, all = 1
|
||||||
|
|
||||||
printf("[zapit] scan mode %s, satellites %s\n", scan_nit ? "fast" : "NIT", scan_sat_mode ? "all" : "single");
|
printf("[zapit] scan mode %s, satellites %s\n", scan_nit ? "fast" : "NIT", scan_sat_mode ? "all" : "single");
|
||||||
CZapitClient myZapitClient;
|
// CZapitClient myZapitClient;
|
||||||
|
|
||||||
/* get first child */
|
/* get first child */
|
||||||
//xmlNodePtr search = xmlDocGetRootElement(scanInputParser)->xmlChildrenNode;
|
//xmlNodePtr search = xmlDocGetRootElement(scanInputParser)->xmlChildrenNode;
|
||||||
@@ -562,7 +562,16 @@ bool CServiceScan::ScanProviders()
|
|||||||
g_bouquetManager->loadBouquets();
|
g_bouquetManager->loadBouquets();
|
||||||
printf("[scan] save bouquets done\n");
|
printf("[scan] save bouquets done\n");
|
||||||
Cleanup(true);
|
Cleanup(true);
|
||||||
|
/* this can hang as the thread handling the connections
|
||||||
|
* could already be in g_Zapit->stopScan(), waiting for
|
||||||
|
* *this* thread to join().
|
||||||
myZapitClient.reloadCurrentServices();
|
myZapitClient.reloadCurrentServices();
|
||||||
|
* so let's do another ugly, layer-violating hack...
|
||||||
|
*/
|
||||||
|
CFrontend::getInstance()->setTsidOnid(0);
|
||||||
|
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
|
||||||
|
CZapit::getInstance()->ZapIt(live_channel_id, false);
|
||||||
|
CZapit::getInstance()->SendEvent(CZapitClient::EVT_SERVICES_CHANGED);
|
||||||
} else {
|
} else {
|
||||||
Cleanup(false);
|
Cleanup(false);
|
||||||
CFrontend::getInstance()->setTsidOnid(0);
|
CFrontend::getInstance()->setTsidOnid(0);
|
||||||
@@ -614,7 +623,7 @@ bool CServiceScan::ScanTransponder()
|
|||||||
if(abort_scan)
|
if(abort_scan)
|
||||||
found_channels = 0;
|
found_channels = 0;
|
||||||
|
|
||||||
CZapitClient myZapitClient;
|
// CZapitClient myZapitClient;
|
||||||
//FIXME move to Cleanup() ?
|
//FIXME move to Cleanup() ?
|
||||||
if(found_channels) {
|
if(found_channels) {
|
||||||
CServiceManager::getInstance()->SaveServices(true);
|
CServiceManager::getInstance()->SaveServices(true);
|
||||||
@@ -625,7 +634,13 @@ bool CServiceScan::ScanTransponder()
|
|||||||
//g_bouquetManager->clearAll();
|
//g_bouquetManager->clearAll();
|
||||||
g_bouquetManager->loadBouquets();
|
g_bouquetManager->loadBouquets();
|
||||||
Cleanup(true);
|
Cleanup(true);
|
||||||
|
/* see the explanation in CServiceScan::ScanProviders() in why this is a bad idea
|
||||||
myZapitClient.reloadCurrentServices();
|
myZapitClient.reloadCurrentServices();
|
||||||
|
*/
|
||||||
|
CFrontend::getInstance()->setTsidOnid(0);
|
||||||
|
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
|
||||||
|
CZapit::getInstance()->ZapIt(live_channel_id, false);
|
||||||
|
CZapit::getInstance()->SendEvent(CZapitClient::EVT_SERVICES_CHANGED);
|
||||||
} else {
|
} else {
|
||||||
Cleanup(false);
|
Cleanup(false);
|
||||||
CFrontend::getInstance()->setTsidOnid(0);
|
CFrontend::getInstance()->setTsidOnid(0);
|
||||||
|
Reference in New Issue
Block a user