Commit Graph

17 Commits

Author SHA1 Message Date
David Fowler 831fa72893 Remove the RequestId from DefaultConnectionContext (#516)
* Remove the RequestId from DefaultConnectionContext
- Added a GetHttpContext() extension method on ConnectionContext
- Also fixed an issue not setting LastSeenUtc
2017-06-03 22:05:44 -10:00
David Fowler b77f50a99a Merge DefaultConnectionContext with ConnectionState (#514)
* Merge DefaultConnectionContext with ConnectionState
- Removed ConnectionState as a result
2017-06-03 12:14:01 -10:00
David Fowler 323dae4ce9 Handle case where scanning happens after dispose. (#475)
- ConnectionManager.Scan would null ref because the timer.Change was being called
after closing all connections.
2017-05-21 23:19:17 -07:00
Nate McMaster ef7a3514cd Upgrade test framework versions and fix test issues (#453) 2017-05-15 12:50:30 -07:00
David Fowler 87e6da6e4c Handle exceptions and Cancellation in DisposeAsync (#366) 2017-04-03 22:21:41 -07:00
David Fowler 8da2dddd49 Fix issue where multiple calls to dispose don't wait properly (#360)
* Fix issue where multiple calls to dispose don't wait properly
- DisposeAsync returned immediately to anyone but the first caller.
This means that it was possible to end the request before properly
waiting on the transport task which means writing after dispose was possible.
- Added a test
2017-04-03 15:25:45 -07:00
BrennanConroy 0abac4a20d Fix null ref in DisposeAsync on ConnectionState 2017-02-28 11:44:25 -08:00
David Fowler 934f6a70d1 Various fixes in HttpConnectionDispatcher (#151)
- The connection state object is manipulated by multiple parties in a non thread safe way. This change introduces a semaphore that should be used by anyone updating or reading the connection state. 
- Handle cases where there's an active request for a connection id and another incoming request for the same connection id, sse and websockets 409 and long polling kicks out the previous connection (https://github.com/aspnet/SignalR/issues/27 and https://github.com/aspnet/SignalR/issues/4)
- Handle requests being processed for disposed connections. There was a race where the background thread could remove and clean up the connection while it was about to be processed.
- Synchronize between the background scanning thread and the request threads when updating the connection state.
- Added `DisposeAndRemoveAsync` to the connection manager that handles`DisposeAsync` throwing and properly removes connections from connection tracking.
- Added Start to ConnectionManager so that testing is easier (background timer doesn't kick in unless start is called).
- Added RequestId to connection state for easier debugging and correlation (can easily see which request is currently processing the logical connection).
- Added tests
2017-01-25 22:27:55 +00:00
David Fowler 9eb42cce2d Clean up disposal of connection state (#148)
* Clean up disposal of connection state
- Removed IDisposable and added a DisposeAsync method to ConnectionState
- Added ApplicationTask and TransportTask to ConnectionState as first class
properties so that it is easy to see (in a process dump or debugger) the
outstanding tasks that Sockets is keeping track of on a per connection basis.
2017-01-25 00:08:08 +00:00
David Fowler cd9ed9228a Remove streaming transport as a top level API (#110)
- Remove Streaming* classes from Sockets. The main
API will be channels based and streaming transports
will use the PipelineChannel (formerly FramingChannel) to
access messages.
- Added WriteAsync and ReadAsync to Connection and hid
the IChannelConnection from public API.
- Also fixed the fact that unknown methods caused server side
exceptions.
- Changed the consumption pattern to WaitToReadAsync/TryRead to avoid
exceptions.
- React to API changes
2017-01-11 04:01:49 -08:00
Andrew Stanton-Nurse d281cb72ea add "messaging" endpoints and transports
* Need a separate set of primitives to handle messaging
* Using Channels (not Pipelines!) to provide the data flow for messaging
* All transports are now "message" based transports
* Added an adaptor to convert message-based transports to serve
streaming endpoints
2017-01-09 16:01:08 -08:00
David Fowler 5f3c1060ab Clean up shutdown management (#59)
* Clean up shutdown management
- ConnectionManager now implements IApplicationEvents. It makes testing cleaner
but makes service registration a little messy.

* Cleaned up service registration and layering a bit
- Added SocketsApplicationLifetimeEvents instead of implementing it
on ConnectionManager directly.
- Exposed ConnectionManager.CloseConnections()
2016-12-05 22:07:19 -08:00
BrennanConroy a96370ea35 Update project.json versions 2016-11-30 12:20:33 -08:00
David Fowler 1b59fc6f80 DI enabled Microsoft.AspNetCore.Sockets (#47)
* DI enabled Microsoft.AspNetCore.Sockets
- Added AddSockets extension method to IServiceCollection
- Inject IApplicationLifetime into ConnectionManager to handle
graceful shutdown and added test.
- Call AddSockets from AddSignalR

* PR feedback
- Added AddSignalR overload that takes Action<SignalROptions>
2016-11-26 23:09:38 -08:00
David Fowler 4aa65cf0bf Updated to new System.IO.Pipelines package instead of Channels 2016-11-15 21:46:18 -08:00
Andrew Stanton-Nurse d299cc9186 apply license headers 2016-11-07 12:00:04 -08:00
David Fowler 3032909f3c Added tests 2016-10-04 01:32:30 -07:00