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
0c38d78d
Commit
0c38d78d
authored
May 11, 2018
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get connection per http session when pool is enabled
parent
8bd7872f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+14
-6
No files found.
Titanium.Web.Proxy/RequestHandler.cs
View file @
0c38d78d
...
...
@@ -57,6 +57,7 @@ namespace Titanium.Web.Proxy
{
var
cancellationToken
=
cancellationTokenSource
.
Token
;
var
prefetchTask
=
prefetchConnectionTask
;
TcpServerConnection
serverConnection
=
null
;
bool
closeServerConnection
=
false
;
...
...
@@ -182,9 +183,9 @@ namespace Titanium.Web.Proxy
bool
newConnection
=
false
;
if
(
serverConnection
==
null
&&
prefetch
Connection
Task
!=
null
)
if
(
serverConnection
==
null
&&
prefetchTask
!=
null
)
{
serverConnection
=
await
prefetch
Connection
Task
;
serverConnection
=
await
prefetchTask
;
newConnection
=
true
;
}
...
...
@@ -206,10 +207,7 @@ namespace Titanium.Web.Proxy
newConnection
=
true
;
}
//for connection pool retry fails until cache is exhausted
//In future once connection pool becomes stable
//we can get connection for each HTTP session instead of per client connection
//That will be more efficient especially when client is holding connection but not using it
//for connection pool retry fails until cache is exhausted
int
attempt
=
0
;
while
(
attempt
<
MaxCachedConnections
+
1
)
{
...
...
@@ -264,6 +262,16 @@ namespace Titanium.Web.Proxy
{
throw
new
Exception
(
"Session was terminated by user."
);
}
//With connection pool get connection for each HTTP session instead of per client connection.
//That will be more efficient especially when client is holding connection but not using it
if
(
EnableConnectionPool
)
{
await
tcpConnectionFactory
.
Release
(
serverConnection
);
serverConnection
=
null
;
prefetchTask
=
null
;
}
}
catch
(
Exception
e
)
when
(!(
e
is
ProxyHttpException
))
{
...
...
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