Commit 6d0d8f6d authored by Honfika's avatar Honfika

fix

parent 8323f79f
...@@ -395,41 +395,40 @@ retry: ...@@ -395,41 +395,40 @@ retry:
tcpServerSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); tcpServerSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
} }
((ProxySocket.ProxySocket)tcpServerSocket).Connect(ipAddress, port); var connectTask = socks
// var connectTask = socks ? ProxySocketConnectionTaskFactory.CreateTask((ProxySocket.ProxySocket)tcpServerSocket, ipAddress, port)
// ? ProxySocketConnectionTaskFactory.CreateTask((ProxySocket.ProxySocket)tcpServerSocket, ipAddress, port) : SocketConnectionTaskFactory.CreateTask(tcpServerSocket, ipAddress, port);
// : SocketConnectionTaskFactory.CreateTask(tcpServerSocket, ipAddress, port);
await Task.WhenAny(connectTask, Task.Delay(proxyServer.ConnectTimeOutSeconds * 1000, cancellationToken));
// await Task.WhenAny(connectTask, Task.Delay(proxyServer.ConnectTimeOutSeconds * 1000, cancellationToken)); if (!connectTask.IsCompleted || !tcpServerSocket.Connected)
// if (!connectTask.IsCompleted || !tcpServerSocket.Connected) {
// { // here we can just do some cleanup and let the loop continue since
// // here we can just do some cleanup and let the loop continue since // we will either get a connection or wind up with a null tcpClient
// // we will either get a connection or wind up with a null tcpClient // which will throw
// // which will throw try
// try {
// { connectTask.Dispose();
// connectTask.Dispose(); }
// } catch
// catch {
// { // ignore
// // ignore }
// } try
// try {
// { #if NET45
//#if NET45 tcpServerSocket?.Close();
// tcpServerSocket?.Close(); #else
//#else tcpServerSocket?.Dispose();
// tcpServerSocket?.Dispose(); #endif
//#endif tcpServerSocket = null;
// tcpServerSocket = null; }
// } catch
// catch {
// { // ignore
// // ignore }
// }
continue;
// continue; }
// }
break; break;
} }
......
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