Skip to content

Commit

Permalink
Merge pull request USNavalResearchLaboratory#6 from USNavalResearchLa…
Browse files Browse the repository at this point in the history
…boratory/thompson/unlimited-rate-fix

Thompson/unlimited rate fix
  • Loading branch information
ljt-git authored Mar 12, 2020
2 parents 482e551 + eff4fe9 commit 22bf665
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/common/mgenTransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,20 @@ void MgenTransport::PrintList()
if (pending_current)
DMSG(0,"Current: %d\n",pending_current->GetFlowId());

}
}


bool MgenTransport::SendPendingMessage()
{
// break out of while loop after N iterations to resume asynch i/o
unsigned int breakOut = 0;
unsigned int pending_message_limit = 10000;

// Send pending messages until we hit congestion
// or clear the queue...
while (IsOpen() && !IsTransmitting() && pending_current)
{
breakOut++;
int msgLimit = pending_current->GetMessageLimit();
bool sendMore = (msgLimit < 0) || (pending_current->GetMessagesSent() < msgLimit);

Expand Down Expand Up @@ -273,7 +280,15 @@ bool MgenTransport::SendPendingMessage()
// cycle back to head of queue if we
// reached the end.
if (!pending_current && pending_head)
pending_current = pending_head;
pending_current = pending_head;

if (breakOut > pending_message_limit)
{
// If we've met our pending_message_limit break out
// of our tight loop sending messages as fast as possible
// to service any off events.
return true;
}

}
// Resume normal operations
Expand Down

0 comments on commit 22bf665

Please sign in to comment.