예제 #1
0
 /// <summary>
 /// Response producer callback.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void ProducerCallback(object sender, ProducerEventArgs e)
 {
     if (e.Buffer != null)
     {
         AsyncSend(e.Buffer, e.ByteCount);
     }
     else
     {
         Close();
     }
 }
예제 #2
0
 public virtual bool ReadAsync(ProducerEventArgs e)
 {
     e.Buffer = Read();
     if (e.Buffer != null)
     {
         e.ByteCount = e.Buffer.Length;
     }
     else
     {
         e.ByteCount = 0;
     }
     return(false);
 }
예제 #3
0
 /// <summary>
 /// Sends the next part of the HTTP response body.
 /// </summary>
 void SendBody()
 {
     if (!response.Producer.Connected)
     {
         response.Producer.Connect(request);
         produceAsyncArgs            = new ProducerEventArgs();
         produceAsyncArgs.Completed += ProducerCallback;
     }
     if (!response.Producer.ReadAsync(produceAsyncArgs))
     {
         ProducerCallback(response.Producer, produceAsyncArgs);
     }
 }
예제 #4
0
 public override bool ReadAsync(ProducerEventArgs e)
 {
     if (endOffset - currentOffset < 1)
     {
         e.Buffer    = null;
         e.ByteCount = 0;
         return(false);
     }
     if (currentOffset + chunkSize >= endOffset)
     {
         readBuffer = new byte[endOffset - currentOffset];
     }
     stream.BeginRead(readBuffer, 0, readBuffer.Length, new AsyncCallback(ReadCallback), e);
     return(true);
 }
예제 #5
0
 public override bool ReadAsync(ProducerEventArgs e)
 {
     backingStream.BeginRead(readBuffer, 0, readBuffer.Length, new AsyncCallback(ReadCallback), e);
     return(true);
 }
예제 #6
0
 public override bool ReadAsync(ProducerEventArgs e)
 {
     backingStream.BeginRead(readBuffer, 0, readBuffer.Length, new AsyncCallback(ReadCallback), e);
     return true;
 }
예제 #7
0
 public override bool ReadAsync(ProducerEventArgs e)
 {
     if (endOffset - currentOffset < 1)
     {
         e.Buffer = null;
         e.ByteCount = 0;
         return false;
     }
     if (currentOffset + chunkSize >= endOffset)
         readBuffer = new byte[endOffset - currentOffset];
     stream.BeginRead(readBuffer, 0, readBuffer.Length, new AsyncCallback(ReadCallback), e);
     return true;
 }
예제 #8
0
 public virtual bool ReadAsync(ProducerEventArgs e)
 {
     e.Buffer = Read();
     if (e.Buffer != null)
         e.ByteCount = e.Buffer.Length;
     else
         e.ByteCount = 0;
     return false;
 }
예제 #9
0
 /// <summary>
 /// Sends the next part of the HTTP response body.
 /// </summary>
 void SendBody()
 {
     if (!response.Producer.Connected)
     {
         response.Producer.Connect(request);
         produceAsyncArgs = new ProducerEventArgs();
         produceAsyncArgs.Completed += ProducerCallback;
     }
     if (!response.Producer.ReadAsync(produceAsyncArgs))
         ProducerCallback(response.Producer, produceAsyncArgs);
 }
예제 #10
0
 /// <summary>
 /// Response producer callback.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void ProducerCallback(object sender, ProducerEventArgs e)
 {
     if (e.Buffer != null)
     {
         AsyncSend(e.Buffer, e.ByteCount);
     }
     else
     {
         Close();
     }
 }