Example #1
0
        void RxDataCallback()
        {
            bool haveData = false;;

            lock (this)
            {
                while (RxPipeReader.QueuedPackets > 0)
                {
                    lastChunk++;
                    int len = RxPipeReader.ReadPacket(chunkData[lastChunk & chunkMask], 0);
                    if (firstChunk <= lastChunk - chunkCount)
                    {
                        firstChunk++;
                    }
                    haveData = true;

                    BytesEaten += len;
                    if (!EatenHistogram.ContainsKey(len))
                    {
                        EatenHistogram.Add(len, 0);
                    }
                    EatenHistogram[len]++;
                    PacketsEaten++;
                }
            }
            if (haveData)
            {
                ChunkNotification cn = NewChunk;
                if (cn != null)
                {
                    cn();
                }
            }
        }
Example #2
0
 void RxDataCallback()
 {
     lock (this)
     {
         while (RxPipeReader.QueuedPackets > 0)
         {
             int len = RxPipeReader.DequeuePacket().Length;
             BytesEaten += len;
             if (!EatenHistogram.ContainsKey(len))
             {
                 EatenHistogram.Add(len, 0);
             }
             EatenHistogram[len]++;
             PacketsEaten++;
         }
     }
 }