Moved send loop one level down.

This commit is contained in:
Alexander Pipelka 2017-09-28 10:25:16 +02:00
parent ece52576dd
commit 46a197d8f8
2 changed files with 22 additions and 21 deletions

View File

@ -271,29 +271,30 @@ cSatipSectionFilterHandler::~cSatipSectionFilterHandler()
Delete(i);
}
bool cSatipSectionFilterHandler::Send(void)
void cSatipSectionFilterHandler::SendAll(void)
{
// zero polling structures
memset(pollFdsM, 0, sizeof(pollFdsM));
while (true) {
// zero polling structures
memset(pollFdsM, 0, sizeof(pollFdsM));
// assemble all handlers to poll
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
if (filtersM[i] && filtersM[i]->Available() != 0) {
pollFdsM[i].fd = filtersM[i]->GetFd();
pollFdsM[i].events = POLLOUT;
}
}
// assemble all handlers to poll
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
if (filtersM[i] && filtersM[i]->Available() != 0) {
pollFdsM[i].fd = filtersM[i]->GetFd();
pollFdsM[i].events = POLLOUT;
}
}
// anyone ready for writing
if (poll(pollFdsM, eMaxSecFilterCount, eSecFilterSendTimeoutMs) <= 0)
return false;
// anyone ready for writing
if (poll(pollFdsM, eMaxSecFilterCount, eSecFilterSendTimeoutMs) <= 0)
return;
// send data
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
if (pollFdsM[i].revents & POLLOUT)
filtersM[i]->Send();
}
return true;
// send data
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
if (pollFdsM[i].revents & POLLOUT)
filtersM[i]->Send();
}
}
}
void cSatipSectionFilterHandler::Action(void)
@ -330,7 +331,7 @@ void cSatipSectionFilterHandler::Action(void)
// Send demuxed section packets through all filters
mutexM.Lock();
while (Send()) ;
SendAll();
mutexM.Unlock();
}
debug1("%s Exiting [device %d]", __PRETTY_FUNCTION__, deviceIndexM);

View File

@ -76,7 +76,7 @@ private:
bool Delete(unsigned int indexP);
bool IsBlackListed(u_short pidP, u_char tidP, u_char maskP) const;
bool Send(void);
void SendAll(void);
protected:
virtual void Action(void);