-
Notifications
You must be signed in to change notification settings - Fork 642
Extract loading and saving certificates; certificate caching improvements #516
Extract loading and saving certificates; certificate caching improvements #516
Conversation
❌ Build Titanium-Web-Proxy 3.0.732 failed (commit 4bbb42366c by @) |
✅ Build Titanium-Web-Proxy 3.0.733 completed (commit bfbd97e736 by @) |
// why Thread.MemoryBarrier is used here and below | ||
cached.Certificate = certificate; | ||
Thread.MemoryBarrier(); | ||
cached.CreationTask = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we setting the Task to null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the task that creates a certificate. The task assigns Certificate
property to the generated certificate and cleans CreationTask
property to allow the Task memory to be released by GC.
task = Task.Run(() => | ||
item.LastAccess = DateTime.Now; | ||
|
||
if (item.Certificate != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be just item!=null ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
item
is always not null.
Actually this condition checks if the certificate creation task is completed, If the certificate creation task is not completed then the Certificate
property of the item
is null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I refactored it removing locking while also preventing multiple tasks for same certificate.
Hi!
I need the ability to have my own certificate disk cache, so I did the following:
Also I did some certificate caching improvements:
Doneness: