aspnetcore/src
moozzyk 23375c911b Fixes a race where wrong task could be awaited in channel completion
We had a startTask we would await in DisposeAsync and channel completion continuation. This task would be initially set to a completed task and then once StartAsync was invoked it would be replaced with the actual task representing StartAsyncInternal. However if a transport failed immediately after starting the channel completion continuation could have been called before the StartAsyncInternal method completed. In this case we would await the inital completed task and then very likely would fail trying to await _receiveLoop task because it wouldn't necessarily be set.
The fix is to use TaskCompletionSource so we don't try to swap tasks. We need to do some additional state checks because:
- the TaskCompletionSource task may never be completed (e.g. DisposeAsync is being called without starting the connection)
- TaskCompletionSource allows setting the result only once and we should not return its task more than once (e.g. calling StartAsync after connection was successfully started and stopped)

Fixes #304
2017-03-16 13:45:18 -07:00
..
Microsoft.AspNetCore.SignalR
Microsoft.AspNetCore.SignalR.Client
Microsoft.AspNetCore.SignalR.Common
Microsoft.AspNetCore.SignalR.Redis
Microsoft.AspNetCore.Sockets add support for binary format in /poll (#303) 2017-03-16 11:06:26 -07:00
Microsoft.AspNetCore.Sockets.Client Fixes a race where wrong task could be awaited in channel completion 2017-03-16 13:45:18 -07:00
Microsoft.AspNetCore.Sockets.Common add support for binary format in /poll (#303) 2017-03-16 11:06:26 -07:00
Microsoft.AspNetCore.WebSockets.Internal
Microsoft.Extensions.WebSockets.Internal