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
1fadb67c
Commit
1fadb67c
authored
May 15, 2017
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#184 move linger state experimentally to avoid object disposed exception on Close
parent
5faaa0b2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
TcpConnection.cs
Titanium.Web.Proxy/Network/Tcp/TcpConnection.cs
+0
-1
TcpConnectionFactory.cs
Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
+2
-0
ProxyServer.cs
Titanium.Web.Proxy/ProxyServer.cs
+7
-8
No files found.
Titanium.Web.Proxy/Network/Tcp/TcpConnection.cs
View file @
1fadb67c
...
...
@@ -58,7 +58,6 @@ namespace Titanium.Web.Proxy.Network.Tcp
StreamReader
?.
Dispose
();
TcpClient
.
LingerState
=
new
LingerOption
(
true
,
0
);
TcpClient
?.
Close
();
}
}
...
...
Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
View file @
1fadb67c
...
...
@@ -133,6 +133,8 @@ namespace Titanium.Web.Proxy.Network.Tcp
client
.
ReceiveTimeout
=
connectionTimeOutSeconds
*
1000
;
client
.
SendTimeout
=
connectionTimeOutSeconds
*
1000
;
client
.
LingerState
=
new
LingerOption
(
true
,
0
);
return
new
TcpConnection
{
UpStreamHttpProxy
=
externalHttpProxy
,
...
...
Titanium.Web.Proxy/ProxyServer.cs
View file @
1fadb67c
...
...
@@ -583,13 +583,18 @@ namespace Titanium.Web.Proxy
//Other errors are discarded to keep proxy running
}
if
(
tcpClient
!=
null
)
{
Task
.
Run
(
async
()
=>
{
ClientConnectionCount
++;
//This line is important!
//contributors please don't remove it without discussion
//It helps to avoid eventual deterioration of performance due to TCP port exhaustion
//due to default TCP CLOSE_WAIT timeout for 4 minutes
tcpClient
.
LingerState
=
new
LingerOption
(
true
,
0
);
try
{
if
(
endPoint
.
GetType
()
==
typeof
(
TransparentProxyEndPoint
))
...
...
@@ -603,14 +608,8 @@ namespace Titanium.Web.Proxy
}
finally
{
//This line is important!
//contributors please don't remove it without discussion
//It helps to avoid eventual deterioration of performance due to TCP port exhaustion
//due to default TCP CLOSE_WAIT timeout for 4 minutes
tcpClient
.
LingerState
=
new
LingerOption
(
true
,
0
);
tcpClient
?.
Close
();
ClientConnectionCount
--;
tcpClient
?.
Close
();
}
});
}
...
...
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