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
c1593254
Commit
c1593254
authored
Mar 09, 2018
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix task exceptions
parent
7c05eeab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
20 deletions
+15
-20
CertificateManager.cs
Titanium.Web.Proxy/Network/CertificateManager.cs
+15
-20
No files found.
Titanium.Web.Proxy/Network/CertificateManager.cs
View file @
c1593254
...
...
@@ -504,7 +504,7 @@ namespace Titanium.Web.Proxy.Network
Task
<
X509Certificate2
>
task
;
if
(
pendingCertificateTasks
.
TryGetValue
(
certificateName
,
out
task
))
{
return
await
GetTaskResult
(
certificateName
,
task
)
;
return
await
task
;
}
//check in cache first
...
...
@@ -518,31 +518,26 @@ namespace Titanium.Web.Proxy.Network
//run certificate creation task
task
=
Task
.
Run
(()
=>
{
return
CreateCertificate
(
certificateName
,
false
);
var
result
=
CreateCertificate
(
certificateName
,
false
);
if
(
result
!=
null
)
{
//this is ConcurrentDictionary
//if key exists it will silently handle; no need for locking
certificateCache
.
TryAdd
(
certificateName
,
new
CachedCertificate
{
Certificate
=
result
});
}
return
result
;
});
pendingCertificateTasks
.
TryAdd
(
certificateName
,
task
);
return
await
GetTaskResult
(
certificateName
,
task
);
}
private
async
Task
<
X509Certificate2
>
GetTaskResult
(
string
certificateName
,
Task
<
X509Certificate2
>
task
)
{
await
task
;
var
certificate
=
await
task
;
pendingCertificateTasks
.
TryRemove
(
certificateName
,
out
task
);
if
(
task
.
Result
!=
null
)
{
//this is ConcurrentDictionary
//if key exists it will silently handle; no need for locking
certificateCache
.
TryAdd
(
certificateName
,
new
CachedCertificate
{
Certificate
=
task
.
Result
});
}
return
certificate
;
return
task
.
Result
;
}
/// <summary>
...
...
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