- length --;
- }
-
- #else
- tTCPStoredPacket *pkt;
- for(;;)
- {
- SHORTLOCK( &Connection->lFuturePackets );
-
- // Clear out duplicates from cache
- // - If a packet has just been recieved, and it is expected, then
- // (since NextSequenceRcv = rcvd->Sequence + rcvd->Length) all
- // packets in cache that are smaller than the next expected
- // are now defunct.
- pkt = Connection->FuturePackets;
- while(pkt && pkt->Sequence < Connection->NextSequenceRcv)
- {
- tTCPStoredPacket *next = pkt->Next;
- free(pkt);
- pkt = next;
- }
-
- // If there's no packets left in cache, stop looking
- if(!pkt || pkt->Sequence > Connection->NextSequenceRcv) {
- SHORTREL( &Connection->lFuturePackets );
- return;
- }
-
- // Delete packet from future list
- Connection->FuturePackets = pkt->Next;
-
- // Release list
- SHORTREL( &Connection->lFuturePackets );
-
- // Looks like we found one
- TCP_INT_AppendRecieved(Connection, pkt->Data, pkt->Length);
- if( Connection->HighestSequenceRcvd == Connection->NextSequenceRcv )
- Connection->HighestSequenceRcvd += pkt->Length;
- Connection->NextSequenceRcv += pkt->Length;
- free(pkt);