Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
6d0d8f6d
Commit
6d0d8f6d
authored
Dec 25, 2019
by
Honfika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
8323f79f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
35 deletions
+34
-35
TcpConnectionFactory.cs
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
+34
-35
No files found.
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
View file @
6d0d8f6d
...
@@ -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
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment