GatherNextPage() private method

private GatherNextPage ( ) : int
return int
示例#1
0
        public Packet PeekNextPacketInternal()
        {
            Packet packet;

            if (_current == null)
            {
                packet = _first;
            }
            else
            {
                while (true)
                {
                    lock (_packetLock)
                    {
                        packet = _current.Next;
                        if ((packet == null || packet.IsContinued) && !_eosFound)
                        {
                            goto IL_004f;
                        }
                    }
                    break;
IL_004f:
                    _container.GatherNextPage(_streamSerial);
                }
            }
            if (packet != null)
            {
                if (packet.IsContinued)
                {
                    throw new InvalidDataException("Packet is incomplete!");
                }
                packet.Reset();
            }
            return(packet);
        }
示例#2
0
 void GetMorePackets()
 {
     // tell our container we need another page...  unless we've found the end of our stream.
     using (var prl = _container.TakePageReaderLock())
     {
         if (!_eosFound)
         {
             _container.GatherNextPage(_streamSerial, prl);
         }
     }
 }
示例#3
0
        Packet PeekNextPacketInternal()
        {
            // try to get the next packet in the sequence
            Packet curPacket;

            if (_current == null)
            {
                curPacket = _first;
            }
            else
            {
                while (true)
                {
                    lock (_packetLock)
                    {
                        curPacket = _current.Next;

                        // if we have a valid packet or we can't get any more, bail out of the loop
                        if ((curPacket != null && !curPacket.IsContinued) || _eosFound)
                        {
                            break;
                        }
                    }

                    // we need another packet and we've not found the end of the stream...
                    _container.GatherNextPage(_streamSerial);
                }
            }

            // if we're returning a packet, prep is for use
            if (curPacket != null)
            {
                if (curPacket.IsContinued)
                {
                    throw new  Exception("Packet is incomplete!");
                }
                curPacket.Reset();
            }

            return(curPacket);
        }