Skip to content

Commit

Permalink
remove pages from _specialPages list when they are marked for deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
ZXGuesser committed Sep 29, 2017
1 parent 339dca8 commit f87806e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packetmag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ Packet* PacketMag::GetPacket(Packet* p)
{
_page=_specialPages->NextPage();

if (_page && _page->GetStatusFlag()==TTXPageStream::MARKED)
{
_specialPages->deletePage(_page);
return nullptr;
}

if (_page)
{
// got a special page
Expand All @@ -108,7 +114,7 @@ Packet* PacketMag::GetPacket(Packet* p)
// Magazine Inventory Page
ClearEvent(EVENT_FIELD); // enforce 20ms page erasure interval
}

/* rules for the control bits are complicated. There are rules to allow the page to be sent as fragments. Since we aren't doing that, all the flags are left clear except for C9 (interrupted sequence) to keep special pages out of rolling headers */
thisStatus = _page->GetPageStatus() & 0x8000; // get transmit flag
thisStatus |= 0x0010;
Expand Down
2 changes: 2 additions & 0 deletions specialpages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ void SpecialPages::addPage(TTXPageStream* p)
void SpecialPages::deletePage(TTXPageStream* p)
{
_specialPagesList.remove(p);
_page = nullptr;
_iter--; // roll back iterator in case this was the last in list
}

TTXPageStream* SpecialPages::NextPage()
Expand Down

0 comments on commit f87806e

Please sign in to comment.