Commit Graph
11 Commits
Author SHA1 Message Date
Stephen Toub 7482b6a4b0 Expose and roll out ValueTask extensibility
This commit does several things:
- Exposes the new `ValueTask` extensibility model being added in coreclr.  The ValueTask-related files will separately be mirrored over to corefx to enable the netstandard build of System.Threading.Tasks.Extensions.
- Adapts all `Stream`-derived types to return `ValueTask` instead of `Task` from `WriteAsync`.
- Changes the new `WebSocket` `SendAsync` method to return `ValueTask` instead of `Task`, and updates the `ManagedWebSocket` implementation accordingly.  Most `SendAsync`s on `ManagedWebSocket` should now return a `ValueTask` that's either completed synchronously (no allocation) or using a pooled object.  It now uses the underlying transport's new `WriteAsync` overload that returns `ValueTask`.
- Switches more uses of `ReadAsync` and `WriteAsync` over to the new overloads, including in Process, DeflateStream, BrotliStream, File, HttpClient, SslStream, WebClient, BufferedStream, CryptoStream,
- Removed some unnecessary array clearing from various routines using ArrayPool (after the clearing was added we changed our minds and decided clearing was only necessary in very specific circumstances)
- Implements a custom `IValueTaskSource` in Socket, such that async receives and sends become allocation-free (ammortized).  `NetworkStream` then inherits this functionality, such that its new `ReadAsync` and `WriteAsync` are also allocation-free (in the unbounded channel implementations; we can subsequently add it in for bounded).
- Implements a custom `IValueTaskSource` in System.Threading.Channels, such that reading and writing are ammortized allocation-free up to one concurrent reader and writer.
- A few random things I noticed as I was going through, e.g. missing ConfigureAwait, some incorrect synchronization in tests, etc.
- Adds a ton of new tests, mainly in System.Threading.Tasks.Extensions, System.Threading.Channels, and System.Net.Sockets.


Commit migrated from https://github.com/dotnet/corefx/commit/6d1671b2cfcf130b7bc6c059bb0508073426532a
2018-03-02 09:56:25 -08:00
Wes Haggard fc9b090ef0 Update references assemblies to include private fields for structs
Contributes to https://github.com/dotnet/corefx/issues/6185.


Commit migrated from https://github.com/dotnet/corefx/commit/2e97d43060dfb589907a15dbfef0cc7db6e90546
2018-01-12 08:53:41 -08:00
Stephen Toub 2941eee4df Add Memory-based Send/ReceiveAsync methods to WebSocket
Commit migrated from https://github.com/dotnet/corefx/commit/e2a978a526afc969d6c19cd9e8562821a038d992
2017-10-24 17:20:46 -04:00
Stephen Toub 1ca1852314 Add WebSocket.CreateFromStream method
Commit migrated from https://github.com/dotnet/corefx/commit/ef0ebe207b0056b0fbbc7a20563bce6baacda19d
2017-10-24 17:15:24 -04:00
Stephen Toub 4ed1899189 Add System.Net.WebSockets serialization
Commit migrated from https://github.com/dotnet/corefx/commit/2096460d5052b2f1dd14350f078e7e6cd13554cc
2016-10-22 06:27:55 -04:00
Eric St. John 5227c7b3f1 Make System.Net.WebSockets target ns1.7
Commit migrated from https://github.com/dotnet/corefx/commit/070ea132f20573247379dd7ff2cbdffa417a45f0
2016-10-20 14:28:42 -07:00
Stephen Toub 52e3c3d7ae Change all refs to use "throw null;" as member bodies
Following our new guidelines for ref assembly implementations and what GenApi now creates, this updates all of our ref .cs files to use "throw null;" for member bodies that can't just be empty (i.e. members that need to return a value either via the return type or via an out parameter).  I made the change programatically using a simple Roslyn-based tool.


Commit migrated from https://github.com/dotnet/corefx/commit/a9fdc79ff8feb5ad46e9fcbe18fdffcd0bd74679
2016-10-13 09:43:23 -04:00
Stephen Toub 7f7cd8a732 Add back missing WebSockets APIs
Adds to System.Net.WebSockets:
- WebSocketException deriving from Win32Exception
- WebSocketException.ctor()
- WebSocket.DefaultKeepAliveInterval
- WebSocket.CreateClientBuffer
- WebSocket.CreateClientWebSocket
- WebSocket.CreateServerBuffer
- WebSocket.IsApplicationTargeting45
- WebSocket.IsStateTerminal
- WebSocket.ReisterPrefixes
- WebSocket.ThrowOnInvalidState
- WebSocketContext.RequestUri
- WebSocketContext.Headers
- WebSocketContext.Origin
- WebSocketContext.SecWebSocketProtocols
- WebSocketContext.SecWebSocketKey
- WebSocketContext.CookieCollection
- WebsocketContext.User
- WebSocketContext.IsAuthenticated
- WebSocketContext.IsLocal
- WebSocketContext.IsSecureConnection
- WebSocketContext.WebSocket

(Several of these members just throw PlatformNotSupportedException. Others have a different implementation than on desktop but something that's reasonable for corefx given the rest of the implementation's differences, e.g. limits on buffer sizes.)

Adds to System.Net.WebSockets.Client:
- ClientWebSocketOptions.UseDefaultCredentials
- ClientWebSocketOptions.SetBuffer(int, int)
- ClientWebSocketOptions.SetBuffer(int, int, ArraySegment<byte>)

As part of this, I also:
- Updated ClientWebSocketOptions.KeepAliveInterval to default to 30 seconds, as it does on desktop, rather than defaulting to 0.
- Updated the managed websockets implementation to take the ClientWebSocketOptions buffer information into account, in particular the receive buffer size and the buffer itself (as long as offset and count don't represent a subset, which would have been a more intrusive change to support).


Commit migrated from https://github.com/dotnet/corefx/commit/c97a2c7ac8ff5a4473348adf2ba6ca6a141de116
2016-09-14 08:11:20 -04:00
stephentoub 685d9f5063 Add API review headers to ref files
Commit migrated from https://github.com/dotnet/corefx/commit/5240b324e50f9aabaa11d4b0c46acc34e370a724
2016-02-11 10:50:44 -05:00
dotnet-bot 39d1eab950 Update licensing headers
Commit migrated from https://github.com/dotnet/corefx/commit/7cad8486cbabbce0236bdf530e30db7036335524
2016-01-27 08:02:28 -08:00
Eric St. John 77309d4821 Update the version of all assemblies
This change updates the assembly versions of all of the corefx assemblies
as needed after we shipped stable versions.  Assemblies with API differences
get a minor version bump.  Assemblies with only bugfixes get a build version
bump.

In order to facilitate this I had to update the reference assemblies, so I took
the opportunity to port them all to the open.

[tfs-changeset: 1514419]


Commit migrated from https://github.com/dotnet/corefx/commit/40723b795917f2e98b64d45c17effb2546dd0cae
2015-08-13 17:07:57 -07:00