Added try finally to semaphore release (#1469)
This commit is contained in:
parent
03ca505fb3
commit
a2ac9c573e
|
|
@ -84,6 +84,8 @@ namespace Microsoft.AspNetCore.SignalR
|
||||||
public int? LocalPort => Features.Get<IHttpConnectionFeature>()?.LocalPort;
|
public int? LocalPort => Features.Get<IHttpConnectionFeature>()?.LocalPort;
|
||||||
|
|
||||||
public virtual async Task WriteAsync(HubMessage message)
|
public virtual async Task WriteAsync(HubMessage message)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
await _writeLock.WaitAsync();
|
await _writeLock.WaitAsync();
|
||||||
|
|
||||||
|
|
@ -94,9 +96,12 @@ namespace Microsoft.AspNetCore.SignalR
|
||||||
Interlocked.Exchange(ref _lastSendTimestamp, Stopwatch.GetTimestamp());
|
Interlocked.Exchange(ref _lastSendTimestamp, Stopwatch.GetTimestamp());
|
||||||
|
|
||||||
await _connectionContext.Transport.Output.FlushAsync(CancellationToken.None);
|
await _connectionContext.Transport.Output.FlushAsync(CancellationToken.None);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
_writeLock.Release();
|
_writeLock.Release();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Abort()
|
public virtual void Abort()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue