Ejemplo n.º 1
0
        /// <summary>
        /// Signal that this chunk should throw an exception on Socket.BeginReceive()
        /// </summary>
        /// <param name="epSender"></param>
        public void LoadReceiveWithBeginException(EndPoint epSender)
        {
            ChunkSenderTuple tuple = new ChunkSenderTuple(epSender);

            tuple.BeginReceiveException = true;
            m_chunksToLoad.Enqueue(tuple);
        }
Ejemplo n.º 2
0
 protected override void BeginReceive()
 {
     if (m_chunksToLoad.Count > 0 && m_chunksToLoad.Peek().BeginReceiveException)
     {
         ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();
         reusedEpSender = tuple.Sender;
         throw new SocketException();
     }
 }
Ejemplo n.º 3
0
        protected override bool EndReceive(out int numBytes, IAsyncResult result, ref EndPoint epSender)
        {
            numBytes = 0;

            //m_log.Debug("Queue size " + m_chunksToLoad.Count);

            if (m_chunksToLoad.Count <= 0)
            {
                return(false);
            }

            ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();

            RecvBuffer = tuple.Data;
            numBytes   = tuple.Data.Length;
            epSender   = tuple.Sender;

            return(true);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Signal that this chunk should throw an exception on Socket.BeginReceive()
 /// </summary>
 /// <param name="epSender"></param>
 public void LoadReceiveWithBeginException(EndPoint epSender)
 {
     ChunkSenderTuple tuple = new ChunkSenderTuple(epSender);
     tuple.BeginReceiveException = true;
     m_chunksToLoad.Enqueue(tuple);
 }