/// <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); }
protected override void BeginReceive() { if (m_chunksToLoad.Count > 0 && m_chunksToLoad.Peek().BeginReceiveException) { ChunkSenderTuple tuple = m_chunksToLoad.Dequeue(); reusedEpSender = tuple.Sender; throw new SocketException(); } }
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); }
/// <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); }