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
4fd1d6f1
Commit
4fd1d6f1
authored
May 15, 2018
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
properly release prefetch task
parent
79cdc5e9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
11 deletions
+36
-11
ExplicitClientHandler.cs
Titanium.Web.Proxy/ExplicitClientHandler.cs
+10
-2
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+16
-7
TransparentClientHandler.cs
Titanium.Web.Proxy/TransparentClientHandler.cs
+10
-2
No files found.
Titanium.Web.Proxy/ExplicitClientHandler.cs
View file @
4fd1d6f1
...
@@ -338,8 +338,16 @@ namespace Titanium.Web.Proxy
...
@@ -338,8 +338,16 @@ namespace Titanium.Web.Proxy
if
(!
calledRequestHandler
if
(!
calledRequestHandler
&&
prefetchConnectionTask
!=
null
)
&&
prefetchConnectionTask
!=
null
)
{
{
var
connection
=
await
prefetchConnectionTask
;
TcpServerConnection
prefetchedConnection
=
null
;
await
tcpConnectionFactory
.
Release
(
connection
,
closeServerConnection
);
try
{
prefetchedConnection
=
await
prefetchConnectionTask
;
}
finally
{
await
tcpConnectionFactory
.
Release
(
prefetchedConnection
,
closeServerConnection
);
}
}
}
clientStream
.
Dispose
();
clientStream
.
Dispose
();
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
4fd1d6f1
...
@@ -58,14 +58,14 @@ namespace Titanium.Web.Proxy
...
@@ -58,14 +58,14 @@ namespace Titanium.Web.Proxy
CancellationTokenSource
cancellationTokenSource
,
string
httpsConnectHostname
,
ConnectRequest
connectRequest
,
CancellationTokenSource
cancellationTokenSource
,
string
httpsConnectHostname
,
ConnectRequest
connectRequest
,
Task
<
TcpServerConnection
>
prefetchConnectionTask
=
null
)
Task
<
TcpServerConnection
>
prefetchConnectionTask
=
null
)
{
{
var
cancellationToken
=
cancellationTokenSource
.
Token
;
var
prefetchTask
=
prefetchConnectionTask
;
var
prefetchTask
=
prefetchConnectionTask
;
TcpServerConnection
connection
=
null
;
TcpServerConnection
connection
=
null
;
bool
closeServerConnection
=
false
;
bool
closeServerConnection
=
false
;
try
try
{
{
var
cancellationToken
=
cancellationTokenSource
.
Token
;
// Loop through each subsequest request on this particular client connection
// Loop through each subsequest request on this particular client connection
// (assuming HTTP connection is kept alive by client)
// (assuming HTTP connection is kept alive by client)
while
(
true
)
while
(
true
)
...
@@ -278,14 +278,23 @@ namespace Titanium.Web.Proxy
...
@@ -278,14 +278,23 @@ namespace Titanium.Web.Proxy
}
}
finally
finally
{
{
await
tcpConnectionFactory
.
Release
(
connection
,
closeServerConnection
);
if
(
prefetchTask
!=
null
)
if
(
prefetchTask
!=
null
)
{
{
await
tcpConnectionFactory
.
Release
(
await
prefetchTask
,
TcpServerConnection
prefetchedConnection
=
null
;
closeServerConnection
);
try
}
{
prefetchedConnection
=
await
prefetchTask
;
await
tcpConnectionFactory
.
Release
(
connection
,
}
closeServerConnection
);
finally
{
await
tcpConnectionFactory
.
Release
(
prefetchedConnection
,
closeServerConnection
);
}
}
}
}
}
}
...
...
Titanium.Web.Proxy/TransparentClientHandler.cs
View file @
4fd1d6f1
...
@@ -165,8 +165,16 @@ namespace Titanium.Web.Proxy
...
@@ -165,8 +165,16 @@ namespace Titanium.Web.Proxy
if
(!
calledRequestHandler
if
(!
calledRequestHandler
&&
prefetchConnectionTask
!=
null
)
&&
prefetchConnectionTask
!=
null
)
{
{
var
connection
=
await
prefetchConnectionTask
;
TcpServerConnection
prefetchedConnection
=
null
;
await
tcpConnectionFactory
.
Release
(
connection
,
closeServerConnection
);
try
{
prefetchedConnection
=
await
prefetchConnectionTask
;
}
finally
{
await
tcpConnectionFactory
.
Release
(
prefetchedConnection
,
closeServerConnection
);
}
}
}
clientStream
.
Dispose
();
clientStream
.
Dispose
();
...
...
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