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
54d3b2dd
Commit
54d3b2dd
authored
Apr 08, 2019
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check for upper limit
parent
124443c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
ProxyServer.cs
src/Titanium.Web.Proxy/ProxyServer.cs
+18
-6
No files found.
src/Titanium.Web.Proxy/ProxyServer.cs
View file @
54d3b2dd
...
@@ -752,20 +752,32 @@ namespace Titanium.Web.Proxy
...
@@ -752,20 +752,32 @@ namespace Titanium.Web.Proxy
endPoint
.
Listener
.
BeginAcceptTcpClient
(
onAcceptConnection
,
endPoint
);
endPoint
.
Listener
.
BeginAcceptTcpClient
(
onAcceptConnection
,
endPoint
);
}
}
private
Lazy
<
int
>
maxWorkerThreads
=
new
Lazy
<
int
>(()
=>
{
int
maxWorkerThreads
;
ThreadPool
.
GetMaxThreads
(
out
maxWorkerThreads
,
out
var
_
);
return
maxWorkerThreads
;
});
/// <summary>
/// <summary>
/// Change the ThreadPool.WorkerThread minThread
/// Change the ThreadPool.WorkerThread minThread
/// </summary>
/// </summary>
/// <param name="
piNbW
orkerThreadsToAdd">Number of threads to add</param>
/// <param name="
w
orkerThreadsToAdd">Number of threads to add</param>
private
void
setThreadPoolMinThread
(
int
piNbW
orkerThreadsToAdd
)
private
void
setThreadPoolMinThread
(
int
w
orkerThreadsToAdd
)
{
{
if
(
EnableThreadPoolOptimizing
)
if
(
EnableThreadPoolOptimizing
)
{
{
lock
(
lockThreadPoolTuning
)
lock
(
lockThreadPoolTuning
)
{
{
int
iWorkerThreads
,
iCompletionPortThreads
;
int
minWorkerThreads
,
minCompletionPortThreads
;
ThreadPool
.
GetMinThreads
(
out
iWorkerThreads
,
out
iCompletionPortThreads
);
iWorkerThreads
=
Math
.
Max
(
iWorkerThreads
+
piNbWorkerThreadsToAdd
,
Environment
.
ProcessorCount
);
ThreadPool
.
GetMinThreads
(
out
minWorkerThreads
,
out
minCompletionPortThreads
);
ThreadPool
.
SetMinThreads
(
iWorkerThreads
,
iCompletionPortThreads
);
minWorkerThreads
=
Math
.
Max
(
minWorkerThreads
+
workerThreadsToAdd
,
Environment
.
ProcessorCount
);
if
(
minWorkerThreads
<=
maxWorkerThreads
.
Value
)
{
ThreadPool
.
SetMinThreads
(
minWorkerThreads
,
minCompletionPortThreads
);
}
}
}
}
}
}
}
...
...
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