-
Notifications
You must be signed in to change notification settings - Fork 524
Move shutdown logic from transport to core #1707
Conversation
halter73
commented
Apr 18, 2017
- Use weak references to track FrameConnections which are equivalent to libuv references.
}); | ||
|
||
var allAbortedTask = Task.WhenAll(abortTasks.ToArray()); | ||
return await Task.WhenAny(allAbortedTask, Task.Delay(1000)).ConfigureAwait(false) == allAbortedTask; |
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.
Hardcoding 1 second?
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.
Abort was previously hard coded to one second. This timeout comes after the shutdown timeout is exceed/token canceled. What would you change this to?
@@ -86,29 +83,13 @@ public LibuvConnection() | |||
// Ensure the socket is disposed prior to completing in the input writer. | |||
_socket.Dispose(); | |||
Input.Complete(new TaskCanceledException("The request was aborted")); | |||
_socketClosedTcs.TrySetResult(null); | |||
_connectionContext.OnConnectionClosed(); |
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.
The code makes it look like there's a chance that OnConnection
can throw and as a result OnConnectionClosed
won't be called.
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.
I don't understand what you're getting at. What looks like it can throw?
@@ -165,7 +165,7 @@ public static IEnumerable<object[]> LargeUploadData | |||
|
|||
using (var reader = new StreamReader(stream, Encoding.ASCII)) | |||
{ | |||
var response = reader.ReadToEnd(); | |||
var response = await reader.ReadToEndAsync(); |
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 needs to be synchronous for the timeout to work.
public async Task CriticalErrorLoggedIfApplicationDoesntComplete() | ||
{ | ||
//////////////////////////////////////////////////////////////////////////////////////// | ||
// WARNING: This test will fail under a debugger because Task.s_currentActiveTasks // |
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.
😞. Should we let this test pass if Debugger.IsAttached
?
@@ -27,8 +27,6 @@ protected UvStreamHandle(ILibuvTrace logger) : base(logger) | |||
{ | |||
} | |||
|
|||
public LibuvConnection Connection { get; set; } |
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.
👏
{ | ||
private readonly ConcurrentDictionary<long, FrameConnection> _connections | ||
= new ConcurrentDictionary<long, FrameConnection>(); | ||
// Internal for testing |
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.
Undo internal
public async Task CriticalErrorLoggedIfApplicationDoesntComplete() | ||
{ | ||
//////////////////////////////////////////////////////////////////////////////////////// | ||
// WARNING: This test will fail under a debugger because Task.s_currentActiveTasks // |
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.
Use custom awaiter?
0155a10
to
3ffe334
Compare
|
d10a05a
to
ec72961
Compare
@@ -24,6 +24,7 @@ public class LoggingConnectionAdapterTests | |||
{ | |||
listenOptions.UseConnectionLogging(); | |||
listenOptions.UseHttps(TestResources.TestCertificatePath, "testPassword"); | |||
listenOptions.UseConnectionLogging(); |
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.
What is this?
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.
LGTM