SSE StopAsync should ignore exception (handled elsewhere) (#708)
This commit is contained in:
parent
eb008a0dfe
commit
b393200fd3
|
|
@ -140,7 +140,15 @@ namespace Microsoft.AspNetCore.Sockets.Client
|
|||
_logger.TransportStopping(_connectionId);
|
||||
_transportCts.Cancel();
|
||||
_application.Out.TryComplete();
|
||||
await Running;
|
||||
|
||||
try
|
||||
{
|
||||
await Running;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// exceptions have been handled in the Running task continuation by closing the channel with the exception
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CanStartConnectionUsingDefaultTransport()
|
||||
public async Task CanStartAndStopConnectionUsingDefaultTransport()
|
||||
{
|
||||
var url = _serverFixture.BaseUrl + "/echo";
|
||||
// The test should connect to the server using WebSockets transport on Windows 8 and newer.
|
||||
|
|
@ -53,6 +53,17 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
await connection.DisposeAsync().OrTimeout();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(TransportTypes))]
|
||||
public async Task CanStartAndStopConnectionUsingGivenTransport(TransportType transportType)
|
||||
{
|
||||
var url = _serverFixture.BaseUrl + "/echo";
|
||||
// When WebSockets is attempted to be used on Windows 7/2008R2 it will instead use ServerSentEvents
|
||||
var connection = new HttpConnection(new Uri(url), transportType);
|
||||
await connection.StartAsync().OrTimeout();
|
||||
await connection.DisposeAsync().OrTimeout();
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
public async Task WebSocketsTest()
|
||||
|
|
|
|||
Loading…
Reference in New Issue