Make sure to release connection lock (#11049)
This commit is contained in:
parent
f76be64e5d
commit
ecd709eb9a
|
|
@ -1942,12 +1942,14 @@ namespace Microsoft.AspNetCore.SignalR.Client
|
||||||
return _connectionLock.Wait(0);
|
return _connectionLock.Wait(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't call this method in a try/finally that releases the lock since we're also potentially releasing the connection lock here.
|
||||||
public async Task<ConnectionState> WaitForActiveConnectionAsync(string methodName, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = 0)
|
public async Task<ConnectionState> WaitForActiveConnectionAsync(string methodName, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = 0)
|
||||||
{
|
{
|
||||||
await WaitConnectionLockAsync(methodName);
|
await WaitConnectionLockAsync(methodName);
|
||||||
|
|
||||||
if (CurrentConnectionStateUnsynchronized == null || CurrentConnectionStateUnsynchronized.Stopping)
|
if (CurrentConnectionStateUnsynchronized == null || CurrentConnectionStateUnsynchronized.Stopping)
|
||||||
{
|
{
|
||||||
|
ReleaseConnectionLock(methodName);
|
||||||
throw new InvalidOperationException($"The '{methodName}' method cannot be called if the connection is not active");
|
throw new InvalidOperationException($"The '{methodName}' method cannot be called if the connection is not active");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -770,7 +770,6 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[Flaky("https://github.com/aspnet/AspNetCore-Internal/issues/2465", FlakyOn.All)]
|
|
||||||
[MemberData(nameof(HubProtocolsAndTransportsAndHubPaths))]
|
[MemberData(nameof(HubProtocolsAndTransportsAndHubPaths))]
|
||||||
[LogLevel(LogLevel.Trace)]
|
[LogLevel(LogLevel.Trace)]
|
||||||
public async Task CanCancelIAsyncEnumerableClientToServerUpload(string protocolName, HttpTransportType transportType, string path)
|
public async Task CanCancelIAsyncEnumerableClientToServerUpload(string protocolName, HttpTransportType transportType, string path)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue