Commit 09bb22da authored by justcoding121's avatar justcoding121

use non-static method

parent d1f26f12
...@@ -14,7 +14,7 @@ namespace Titanium.Web.Proxy.Helpers ...@@ -14,7 +14,7 @@ namespace Titanium.Web.Proxy.Helpers
/// <seealso cref="System.IO.Stream" /> /// <seealso cref="System.IO.Stream" />
internal class CustomBufferedStream : Stream internal class CustomBufferedStream : Stream
{ {
private readonly AsyncCallback readCallback = ReadCallback; private AsyncCallback readCallback;
private readonly Stream baseStream; private readonly Stream baseStream;
...@@ -27,6 +27,7 @@ namespace Titanium.Web.Proxy.Helpers ...@@ -27,6 +27,7 @@ namespace Titanium.Web.Proxy.Helpers
private int bufferPos; private int bufferPos;
private bool disposed; private bool disposed;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="CustomBufferedStream"/> class. /// Initializes a new instance of the <see cref="CustomBufferedStream"/> class.
/// </summary> /// </summary>
...@@ -34,6 +35,7 @@ namespace Titanium.Web.Proxy.Helpers ...@@ -34,6 +35,7 @@ namespace Titanium.Web.Proxy.Helpers
/// <param name="bufferSize">Size of the buffer.</param> /// <param name="bufferSize">Size of the buffer.</param>
public CustomBufferedStream(Stream baseStream, int bufferSize) public CustomBufferedStream(Stream baseStream, int bufferSize)
{ {
readCallback = new AsyncCallback(ReadCallback);
this.baseStream = baseStream; this.baseStream = baseStream;
streamBuffer = BufferPool.GetBuffer(bufferSize); streamBuffer = BufferPool.GetBuffer(bufferSize);
} }
...@@ -137,7 +139,7 @@ namespace Titanium.Web.Proxy.Helpers ...@@ -137,7 +139,7 @@ namespace Titanium.Web.Proxy.Helpers
return result; return result;
} }
private static void ReadCallback(IAsyncResult ar) private void ReadCallback(IAsyncResult ar)
{ {
var readResult = (ReadAsyncResult)ar.AsyncState; var readResult = (ReadAsyncResult)ar.AsyncState;
readResult.BaseResult = ar; readResult.BaseResult = ar;
...@@ -363,6 +365,7 @@ namespace Titanium.Web.Proxy.Helpers ...@@ -363,6 +365,7 @@ namespace Titanium.Web.Proxy.Helpers
baseStream.Dispose(); baseStream.Dispose();
BufferPool.ReturnBuffer(streamBuffer); BufferPool.ReturnBuffer(streamBuffer);
streamBuffer = null; streamBuffer = null;
readCallback = null;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment