Refactor the TorWebClient
This commit is contained in:
@@ -44,6 +44,12 @@ namespace Tor.Proxy
|
||||
|
||||
#region System.IDisposable
|
||||
|
||||
|
||||
public Connection Connection
|
||||
{
|
||||
get{return connection;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||
/// </summary>
|
||||
@@ -72,6 +78,11 @@ namespace Tor.Proxy
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDisposed()
|
||||
{
|
||||
return disposed;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region System.Net.Sockets.Socket
|
||||
@@ -86,15 +97,14 @@ namespace Tor.Proxy
|
||||
{
|
||||
if (connection != null && connection.Socket != null)
|
||||
{
|
||||
connection.Profiler.Reset();
|
||||
int received = connection.Socket.EndReceive(ar);
|
||||
// MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Received {0} bytes from {1}",received,connection.Socket.RemoteEndPoint));
|
||||
if (received > 0)
|
||||
{
|
||||
if (destinationSocket != null)
|
||||
{
|
||||
destinationSocket.BeginSend(connectionBuffer, 0, received, SocketFlags.None, OnDestinationSocketSent, destinationSocket);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -197,9 +207,6 @@ namespace Tor.Proxy
|
||||
if (destinationSocket != null)
|
||||
{
|
||||
int dispatched = destinationSocket.EndSend(ar);
|
||||
|
||||
// MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Dispatched {0} bytes to {1}",dispatched,destinationSocket.RemoteEndPoint));
|
||||
|
||||
if (dispatched > 0)
|
||||
{
|
||||
if (connection != null && connection.Socket != null)
|
||||
|
||||
Reference in New Issue
Block a user