Narrow ping write lock.

This commit is contained in:
Chris Ross 2014-03-10 08:32:59 -07:00
parent 2dbe40dca5
commit 1853c71114
1 changed files with 2 additions and 3 deletions

View File

@ -156,10 +156,9 @@ namespace Microsoft.Net.WebSockets
private async void SendKeepAliveAsync()
{
// Check concurrent writes, pings & pongs, or closes
bool lockAquired = await _writeLock.WaitAsync(TimeSpan.FromMinutes(1)); // TODO: Wait up to KeepAliveInterval?
if (!lockAquired)
if (!_writeLock.Wait(0))
{
// Pings aren't that important, discard them if we can't take the lock.
// Sending real data is better than a ping, discard it.
return;
}
try