mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Merge pull request #45 from pipelka/sectionfilter-poll-fix
Ignore handlers without any data.
This commit is contained in:
commit
dbe67a2242
@ -274,34 +274,34 @@ cSatipSectionFilterHandler::~cSatipSectionFilterHandler()
|
|||||||
void cSatipSectionFilterHandler::SendAll(void)
|
void cSatipSectionFilterHandler::SendAll(void)
|
||||||
{
|
{
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
bool retry;
|
bool pendingData;
|
||||||
do {
|
do {
|
||||||
retry = false;
|
pendingData = false;
|
||||||
|
|
||||||
// zero polling structures
|
// zero polling structures
|
||||||
memset(pollFdsM, 0, sizeof(pollFdsM));
|
memset(pollFdsM, 0, sizeof(pollFdsM));
|
||||||
|
|
||||||
// assemble all handlers to poll
|
// assemble all handlers to poll (use -1 to ignore handlers)
|
||||||
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
||||||
if (filtersM[i] && filtersM[i]->Available() != 0) {
|
if (filtersM[i] && filtersM[i]->Available() != 0) {
|
||||||
pollFdsM[i].fd = filtersM[i]->GetFd();
|
pollFdsM[i].fd = filtersM[i]->GetFd();
|
||||||
pollFdsM[i].events = POLLOUT;
|
pollFdsM[i].events = POLLOUT;
|
||||||
|
pendingData = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
pollFdsM[i].fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// anyone ready for writing
|
// exit if there isn't any pending data or we time out
|
||||||
if (poll(pollFdsM, eMaxSecFilterCount, eSecFilterSendTimeoutMs) <= 0)
|
if (!pendingData || poll(pollFdsM, eMaxSecFilterCount, eSecFilterSendTimeoutMs) <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// send data
|
// send data (if available)
|
||||||
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
for (unsigned int i = 0; i < eMaxSecFilterCount && pendingData; ++i) {
|
||||||
if (pollFdsM[i].revents & POLLOUT)
|
if (pollFdsM[i].revents & POLLOUT)
|
||||||
filtersM[i]->Send();
|
filtersM[i]->Send();
|
||||||
|
|
||||||
if (!retry && filtersM[i] && filtersM[i]->Available() != 0)
|
|
||||||
retry = true;
|
|
||||||
}
|
}
|
||||||
} while (retry);
|
} while (pendingData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cSatipSectionFilterHandler::Action(void)
|
void cSatipSectionFilterHandler::Action(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user