Merge in 'release/3.1' changes
This commit is contained in:
commit
b110c810a4
|
|
@ -501,6 +501,11 @@ namespace Microsoft.AspNetCore.SignalR.Client
|
||||||
{
|
{
|
||||||
connectionState.Stopping = true;
|
connectionState.Stopping = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Reset StopCts if there isn't an active connection so that the next StartAsync wont immediately fail due to the token being canceled
|
||||||
|
_state.StopCts = new CancellationTokenSource();
|
||||||
|
}
|
||||||
|
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -334,6 +334,26 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task StopAsyncOnInactiveConnectionDoesNotAffectNextStartAsync()
|
||||||
|
{
|
||||||
|
// Regression test:
|
||||||
|
// If there wasn't an active underlying connection, StopAsync would leave a CTS canceled which would cause the next StartAsync to fail
|
||||||
|
var testConnection = new TestConnection();
|
||||||
|
await AsyncUsing(CreateHubConnection(testConnection), async connection =>
|
||||||
|
{
|
||||||
|
Assert.Equal(HubConnectionState.Disconnected, connection.State);
|
||||||
|
|
||||||
|
await connection.StopAsync().OrTimeout();
|
||||||
|
Assert.False(testConnection.Disposed.IsCompleted);
|
||||||
|
Assert.Equal(HubConnectionState.Disconnected, connection.State);
|
||||||
|
|
||||||
|
await connection.StartAsync().OrTimeout();
|
||||||
|
Assert.True(testConnection.Started.IsCompleted);
|
||||||
|
Assert.Equal(HubConnectionState.Connected, connection.State);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task CompletingTheTransportSideMarksConnectionAsClosed()
|
public async Task CompletingTheTransportSideMarksConnectionAsClosed()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue