Repository navigation
WinHttpHandler uses async WinHTTP patterns - #3867
Conversation
|
@CIPop @stephentoub PTAL |
|
Test this please (a socket test was failing on linux debug: gist with jenkins URL) |
There was a problem hiding this comment.
Can you make these readonly, or at least the cache lock? Also, if you're not going to be handing out the _credentialCache to anyone, you might consider just locking on it. And if you wanted to be able to easily change that decision in the future, you could do:
private object CredentialCacheLock { get { return _credentialCache; } }and then lock on CredentialCacheLock.
There was a problem hiding this comment.
I will make them both readonly.
I didn't make them as properties because I was worried about the overhead of using getter's instead of just accessing the field itself. Is there an overhead to worry about or will the compiler be smart and inline?
There was a problem hiding this comment.
They don't need to be properties; the only reason I suggested it for the lock was so that you could avoid allocating another object but still have a nice "lock" name for whatever object you end up using as the lock. That said, yes, the JIT should inline such simple getters.
There was a problem hiding this comment.
Thx for the clarification. I will leave them for now as 2 separate things but marked as readonly. As this evolves, I'll consider the suggestions for further optimizations.
|
Left a variety of comments, but overall looks good. |
There was a problem hiding this comment.
Please add an issue # for all TODOs in the PR.
There was a problem hiding this comment.
I have issue #'s for all TODO's.
This is a large PR and addresses work item #3000. I apologize for not being able to structure it in a series of smaller commits.
The bulk of this PR is switching WinHttpHandler to use the async pattern of calling WinHTTP APIs. This involved a significant restructuring of the code. As part of that, I split up the large WinHttpHandler class into multiple, smaller, helper classes.
While the intent of using async WinHTTP calls is better performance and cancel-ability, this PR has not been fully optimized yet. Due to the schedule of RC1 code complete next week, it's important that this PR get in and get mileage on it in the next few weeks.
There are several TODO items that will be done in later PR's. There is still work being tracked in #2165 for various follow-up items. For example, re-conciling the best SafeHandle pattern to use for WinHTTP between WebSockets.Client and WinHttpHandler.
I'm currently using a simple Debug.WriteLine for verbose debug logging which can be turned on/off via environment variable. I plan to switch this to System.Net ETW trace loggers in the next commit and/or PR. But the logging has proved very useful in diagnosing issues.
Please provide feedback. Depending on the feedback, some of it will be marked as follow-up items for future PRs.