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
56de40a3
Commit
56de40a3
authored
May 14, 2018
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use try finally to release connection
parent
abc21b87
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
50 deletions
+64
-50
ExplicitClientHandler.cs
Titanium.Web.Proxy/ExplicitClientHandler.cs
+39
-29
TransparentClientHandler.cs
Titanium.Web.Proxy/TransparentClientHandler.cs
+25
-21
No files found.
Titanium.Web.Proxy/ExplicitClientHandler.cs
View file @
56de40a3
...
...
@@ -212,6 +212,8 @@ namespace Titanium.Web.Proxy
var
connection
=
await
getServerConnection
(
connectArgs
,
true
,
null
,
cancellationToken
);
try
{
if
(
isClientHello
)
{
int
available
=
clientStream
.
Available
;
...
...
@@ -242,8 +244,11 @@ namespace Titanium.Web.Proxy
(
buffer
,
offset
,
count
)
=>
{
connectArgs
.
OnDataSent
(
buffer
,
offset
,
count
);
},
(
buffer
,
offset
,
count
)
=>
{
connectArgs
.
OnDataReceived
(
buffer
,
offset
,
count
);
},
connectArgs
.
CancellationTokenSource
,
ExceptionFunc
);
}
finally
{
await
tcpConnectionFactory
.
Release
(
connection
,
true
);
}
return
;
}
}
...
...
@@ -276,7 +281,8 @@ namespace Titanium.Web.Proxy
// create new connection
var
connection
=
await
getServerConnection
(
connectArgs
,
true
,
SslExtensions
.
Http2ProtocolAsList
,
cancellationToken
);
try
{
await
connection
.
StreamWriter
.
WriteLineAsync
(
"PRI * HTTP/2.0"
,
cancellationToken
);
await
connection
.
StreamWriter
.
WriteLineAsync
(
cancellationToken
);
await
connection
.
StreamWriter
.
WriteLineAsync
(
"SM"
,
cancellationToken
);
...
...
@@ -288,9 +294,13 @@ namespace Titanium.Web.Proxy
(
buffer
,
offset
,
count
)
=>
{
connectArgs
.
OnDataReceived
(
buffer
,
offset
,
count
);
},
connectArgs
.
CancellationTokenSource
,
clientConnection
.
Id
,
ExceptionFunc
);
#endif
}
finally
{
await
tcpConnectionFactory
.
Release
(
connection
,
true
);
}
}
}
calledRequestHandler
=
true
;
// Now create the request
await
handleHttpSessionRequest
(
endPoint
,
clientConnection
,
clientStream
,
clientStreamWriter
,
...
...
Titanium.Web.Proxy/TransparentClientHandler.cs
View file @
56de40a3
...
...
@@ -98,7 +98,8 @@ namespace Titanium.Web.Proxy
null
,
false
,
null
,
true
,
this
,
UpStreamEndPoint
,
UpStreamHttpsProxy
,
cancellationToken
);
try
{
var
serverStream
=
connection
.
Stream
;
int
available
=
clientStream
.
Available
;
...
...
@@ -122,10 +123,13 @@ namespace Titanium.Web.Proxy
await
TcpHelper
.
SendRaw
(
clientStream
,
serverStream
,
BufferPool
,
BufferSize
,
null
,
null
,
cancellationTokenSource
,
ExceptionFunc
);
}
finally
{
await
tcpConnectionFactory
.
Release
(
connection
,
true
);
return
;
}
return
;
}
}
calledRequestHandler
=
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