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
b138175c
Commit
b138175c
authored
Apr 08, 2019
by
justcoding121
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into beta
parents
abb571f8
124443c5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
141 additions
and
57 deletions
+141
-57
Titanium.Web.Proxy.ProxyServer.html
docs/api/Titanium.Web.Proxy.ProxyServer.html
+83
-51
index.json
docs/index.json
+1
-1
xrefmap.yml
docs/xrefmap.yml
+13
-0
TcpConnectionFactory.cs
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
+0
-2
ProxyServer.cs
src/Titanium.Web.Proxy/ProxyServer.cs
+44
-3
No files found.
docs/api/Titanium.Web.Proxy.ProxyServer.html
View file @
b138175c
This diff is collapsed.
Click to expand it.
docs/index.json
View file @
b138175c
This diff is collapsed.
Click to expand it.
docs/xrefmap.yml
View file @
b138175c
...
...
@@ -3505,6 +3505,19 @@ references:
isSpec
:
"
True"
fullName
:
Titanium.Web.Proxy.ProxyServer.EnableTcpServerConnectionPrefetch
nameWithType
:
ProxyServer.EnableTcpServerConnectionPrefetch
-
uid
:
Titanium.Web.Proxy.ProxyServer.EnableThreadPoolOptimizing
name
:
EnableThreadPoolOptimizing
href
:
api/Titanium.Web.Proxy.ProxyServer.html#Titanium_Web_Proxy_ProxyServer_EnableThreadPoolOptimizing
commentId
:
P:Titanium.Web.Proxy.ProxyServer.EnableThreadPoolOptimizing
fullName
:
Titanium.Web.Proxy.ProxyServer.EnableThreadPoolOptimizing
nameWithType
:
ProxyServer.EnableThreadPoolOptimizing
-
uid
:
Titanium.Web.Proxy.ProxyServer.EnableThreadPoolOptimizing*
name
:
EnableThreadPoolOptimizing
href
:
api/Titanium.Web.Proxy.ProxyServer.html#Titanium_Web_Proxy_ProxyServer_EnableThreadPoolOptimizing_
commentId
:
Overload:Titanium.Web.Proxy.ProxyServer.EnableThreadPoolOptimizing
isSpec
:
"
True"
fullName
:
Titanium.Web.Proxy.ProxyServer.EnableThreadPoolOptimizing
nameWithType
:
ProxyServer.EnableThreadPoolOptimizing
-
uid
:
Titanium.Web.Proxy.ProxyServer.EnableWinAuth
name
:
EnableWinAuth
href
:
api/Titanium.Web.Proxy.ProxyServer.html#Titanium_Web_Proxy_ProxyServer_EnableWinAuth
...
...
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
View file @
b138175c
...
...
@@ -274,8 +274,6 @@ namespace Titanium.Web.Proxy.Network.Tcp
NoDelay
=
proxyServer
.
NoDelay
,
ReceiveTimeout
=
proxyServer
.
ConnectionTimeOutSeconds
*
1000
,
SendTimeout
=
proxyServer
.
ConnectionTimeOutSeconds
*
1000
,
SendBufferSize
=
proxyServer
.
BufferSize
,
ReceiveBufferSize
=
proxyServer
.
BufferSize
,
LingerState
=
new
LingerOption
(
true
,
proxyServer
.
TcpTimeWaitSeconds
)
};
...
...
src/Titanium.Web.Proxy/ProxyServer.cs
View file @
b138175c
...
...
@@ -57,6 +57,11 @@ namespace Titanium.Web.Proxy
/// </summary>
private
WinHttpWebProxyFinder
systemProxyResolver
;
/// <summary>
/// lock for Thread Pool tuning
/// </summary>
private
object
lockThreadPoolTuning
=
new
object
();
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of ProxyServer class with provided parameters.
...
...
@@ -173,6 +178,12 @@ namespace Titanium.Web.Proxy
/// </summary>
public
bool
EnableTcpServerConnectionPrefetch
{
get
;
set
;
}
=
true
;
/// <summary>
/// Gets or sets a Boolean value that specifies whether ThreadPool grows new connections and decrease when connections close
/// Defaults to true.
/// </summary>
public
bool
EnableThreadPoolOptimizing
{
get
;
set
;
}
=
true
;
/// <summary>
/// Gets or sets a Boolean value that specifies whether server and client stream Sockets are using the Nagle algorithm.
/// Defaults to true, no nagle algorithm is used.
...
...
@@ -721,13 +732,44 @@ namespace Titanium.Web.Proxy
if
(
tcpClient
!=
null
)
{
Task
.
Run
(
async
()
=>
{
await
handleClient
(
tcpClient
,
endPoint
);
});
setThreadPoolMinThread
(
1
);
// increase the ThreadPool
Task
.
Run
(
async
()
=>
{
try
{
await
handleClient
(
tcpClient
,
endPoint
);
}
finally
{
setThreadPoolMinThread
(-
1
);
//decrease the Threadpool
}
});
}
// Get the listener that handles the client request.
endPoint
.
Listener
.
BeginAcceptTcpClient
(
onAcceptConnection
,
endPoint
);
}
/// <summary>
/// Change the ThreadPool.WorkerThread minThread
/// </summary>
/// <param name="piNbWorkerThreadsToAdd">Number of threads to add</param>
private
void
setThreadPoolMinThread
(
int
piNbWorkerThreadsToAdd
)
{
if
(
EnableThreadPoolOptimizing
)
{
lock
(
lockThreadPoolTuning
)
{
int
iWorkerThreads
,
iCompletionPortThreads
;
ThreadPool
.
GetMinThreads
(
out
iWorkerThreads
,
out
iCompletionPortThreads
);
iWorkerThreads
=
Math
.
Max
(
iWorkerThreads
+
piNbWorkerThreadsToAdd
,
Environment
.
ProcessorCount
);
ThreadPool
.
SetMinThreads
(
iWorkerThreads
,
iCompletionPortThreads
);
}
}
}
/// <summary>
/// Handle the client.
/// </summary>
...
...
@@ -738,8 +780,7 @@ namespace Titanium.Web.Proxy
{
tcpClient
.
ReceiveTimeout
=
ConnectionTimeOutSeconds
*
1000
;
tcpClient
.
SendTimeout
=
ConnectionTimeOutSeconds
*
1000
;
tcpClient
.
SendBufferSize
=
BufferSize
;
tcpClient
.
ReceiveBufferSize
=
BufferSize
;
tcpClient
.
LingerState
=
new
LingerOption
(
true
,
TcpTimeWaitSeconds
);
await
InvokeConnectionCreateEvent
(
tcpClient
,
true
);
...
...
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