Commit 323808b0 authored by Honfika's avatar Honfika

merge

parents b296e183 808df9f8
......@@ -34,12 +34,12 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary>
internal SessionEventArgs(int bufferSize, ProxyEndPoint endPoint,
CancellationTokenSource cancellationTokenSource, ExceptionHandler exceptionFunc)
: this(bufferSize, endPoint, cancellationTokenSource, null, exceptionFunc)
: this(bufferSize, endPoint, null, cancellationTokenSource, exceptionFunc)
{
}
protected SessionEventArgs(int bufferSize, ProxyEndPoint endPoint,
CancellationTokenSource cancellationTokenSource, Request request, ExceptionHandler exceptionFunc)
Request request, CancellationTokenSource cancellationTokenSource, ExceptionHandler exceptionFunc)
: base(bufferSize, endPoint, cancellationTokenSource, request, exceptionFunc)
{
}
......
......@@ -7,7 +7,7 @@ namespace Titanium.Web.Proxy.EventArguments
public class TunnelConnectSessionEventArgs : SessionEventArgsBase
{
internal TunnelConnectSessionEventArgs(int bufferSize, ProxyEndPoint endPoint, ConnectRequest connectRequest,
ExceptionHandler exceptionFunc, CancellationTokenSource cancellationTokenSource)
CancellationTokenSource cancellationTokenSource, ExceptionHandler exceptionFunc)
: base(bufferSize, endPoint, cancellationTokenSource, connectRequest, exceptionFunc)
{
}
......
......@@ -126,12 +126,12 @@ namespace Titanium.Web.Proxy.Helpers
/// <param name="bufferSize"></param>
/// <param name="onDataSend"></param>
/// <param name="onDataReceive"></param>
/// <param name="exceptionFunc"></param>
/// <param name="cancellationTokenSource"></param>
/// <param name="exceptionFunc"></param>
/// <returns></returns>
internal static async Task SendRawApm(Stream clientStream, Stream serverStream, int bufferSize,
Action<byte[], int, int> onDataSend, Action<byte[], int, int> onDataReceive, ExceptionHandler exceptionFunc,
CancellationTokenSource cancellationTokenSource)
Action<byte[], int, int> onDataSend, Action<byte[], int, int> onDataReceive, CancellationTokenSource cancellationTokenSource,
ExceptionHandler exceptionFunc)
{
var taskCompletionSource = new TaskCompletionSource<bool>();
cancellationTokenSource.Token.Register(() => taskCompletionSource.TrySetResult(true));
......@@ -141,8 +141,8 @@ namespace Titanium.Web.Proxy.Helpers
var serverBuffer = BufferPool.GetBuffer(bufferSize);
try
{
BeginRead(clientStream, serverStream, clientBuffer, cancellationTokenSource, onDataSend, exceptionFunc);
BeginRead(serverStream, clientStream, serverBuffer, cancellationTokenSource, onDataReceive,
BeginRead(clientStream, serverStream, clientBuffer, onDataSend, cancellationTokenSource, exceptionFunc);
BeginRead(serverStream, clientStream, serverBuffer, onDataReceive, cancellationTokenSource,
exceptionFunc);
await taskCompletionSource.Task;
}
......@@ -154,7 +154,7 @@ namespace Titanium.Web.Proxy.Helpers
}
private static void BeginRead(Stream inputStream, Stream outputStream, byte[] buffer,
CancellationTokenSource cancellationTokenSource, Action<byte[], int, int> onCopy,
Action<byte[], int, int> onCopy, CancellationTokenSource cancellationTokenSource,
ExceptionHandler exceptionFunc)
{
if (cancellationTokenSource.IsCancellationRequested)
......@@ -193,7 +193,7 @@ namespace Titanium.Web.Proxy.Helpers
try
{
outputStream.EndWrite(ar2);
BeginRead(inputStream, outputStream, buffer, cancellationTokenSource, onCopy,
BeginRead(inputStream, outputStream, buffer, onCopy, cancellationTokenSource,
exceptionFunc);
}
catch (IOException ex)
......@@ -230,12 +230,12 @@ namespace Titanium.Web.Proxy.Helpers
/// <param name="bufferSize"></param>
/// <param name="onDataSend"></param>
/// <param name="onDataReceive"></param>
/// <param name="exceptionFunc"></param>
/// <param name="cancellationTokenSource"></param>
/// <param name="exceptionFunc"></param>
/// <returns></returns>
private static async Task SendRawTap(Stream clientStream, Stream serverStream, int bufferSize,
Action<byte[], int, int> onDataSend, Action<byte[], int, int> onDataReceive, ExceptionHandler exceptionFunc,
CancellationTokenSource cancellationTokenSource)
Action<byte[], int, int> onDataSend, Action<byte[], int, int> onDataReceive, CancellationTokenSource cancellationTokenSource,
ExceptionHandler exceptionFunc)
{
//Now async relay all server=>client & client=>server data
var sendRelay =
......@@ -259,16 +259,16 @@ namespace Titanium.Web.Proxy.Helpers
/// <param name="bufferSize"></param>
/// <param name="onDataSend"></param>
/// <param name="onDataReceive"></param>
/// <param name="exceptionFunc"></param>
/// <param name="cancellationTokenSource"></param>
/// <param name="exceptionFunc"></param>
/// <returns></returns>
internal static Task SendRaw(Stream clientStream, Stream serverStream, int bufferSize,
Action<byte[], int, int> onDataSend, Action<byte[], int, int> onDataReceive, ExceptionHandler exceptionFunc,
CancellationTokenSource cancellationTokenSource)
Action<byte[], int, int> onDataSend, Action<byte[], int, int> onDataReceive, CancellationTokenSource cancellationTokenSource,
ExceptionHandler exceptionFunc)
{
// todo: fix APM mode
return SendRawTap(clientStream, serverStream, bufferSize, onDataSend, onDataReceive, exceptionFunc,
cancellationTokenSource);
return SendRawTap(clientStream, serverStream, bufferSize, onDataSend, onDataReceive, cancellationTokenSource,
exceptionFunc);
}
}
}
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