Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocket Refactoring #48749

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e91aaa2
Refactoring websocket - splitting the sending and receiving to reduce…
zlatanov Feb 24, 2021
9aa4648
Forgot to call dispose on sender / receiver.
zlatanov Feb 24, 2021
757755b
Added tests and fixed some of the existing ones to not use sockets.
zlatanov Feb 24, 2021
1a3e10c
Refactored the sender to allow the usage of segments - meaning that w…
zlatanov Feb 24, 2021
5a32d3b
Moving header parsing in receiver.
zlatanov Feb 25, 2021
b37189f
Fixed a bug where empty message would issue a read on the socket need…
zlatanov Feb 25, 2021
4569d78
Performance optimizations for sender.
zlatanov Feb 26, 2021
9cbdbe8
More perf improvements for sending. Removed semaphoreslim and replace…
zlatanov Feb 26, 2021
22e888d
Fixed wrong test - ping message from client must include mask.
zlatanov Feb 27, 2021
0b7f461
Fixed wrong debug assert.
zlatanov Feb 27, 2021
3090f69
SendLock included in csproj.
zlatanov Feb 27, 2021
41b6fa1
Receiver rewritten using IValueTaskSource to avoid async path allocat…
zlatanov Feb 27, 2021
538f591
Fixed a bug where eof of message wasn't considering that the message …
zlatanov Feb 27, 2021
17ed798
Optimized ReceiveAsyncPrivate for the case when the receive can compl…
zlatanov Feb 27, 2021
c5f3d67
Reducing the size of ReceiveResult.
zlatanov Feb 27, 2021
65185dc
No need to run continuations asynchronously for send.
zlatanov Feb 27, 2021
87f7a4e
Reducing the memory footprint of the receiver.
zlatanov Feb 28, 2021
7c69845
Better handling of receive header buffer.
zlatanov Feb 28, 2021
88604f8
Fixed typo.
zlatanov Mar 1, 2021
2f88be0
ReceiveAsync is now allocation free even for async paths when the rec…
zlatanov Mar 1, 2021
e2b4c1a
Removed no longer needed classes and reduced the private state for Ma…
zlatanov Mar 2, 2021
ecf289b
Use bool instead of object to use less space.
zlatanov Mar 2, 2021
77f3b7a
Merge branch 'main' into websocket-refactor
zlatanov Mar 2, 2021
fce48ad
Removed the custom SendLock.
zlatanov Mar 3, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 65 additions & 2 deletions src/libraries/System.Net.WebSockets/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
@@ -1,4 +1,64 @@
<root>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema

Version 2.0

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>

There are any number of "resheader" rows that contain simple
name/value pairs.

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
Expand Down Expand Up @@ -138,4 +198,7 @@
<data name="NotWriteableStream" xml:space="preserve">
<value>The base stream is not writeable.</value>
</data>
</root>
<data name="net_Websockets_ServerReceivedUnmaskedFrame" xml:space="preserve">
<value>The WebSocket server received a frame header without a mask.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
<Compile Include="System\Net\WebSockets\WebSocketReceiveResult.cs" />
<Compile Include="System\Net\WebSockets\WebSocketState.cs" />
<Compile Include="System\Net\WebSockets\ManagedWebSocket.cs" />
<Compile Include="System\Net\WebSockets\ManagedWebSocket.Receiver.cs" />
<Compile Include="System\Net\WebSockets\ManagedWebSocket.Sender.cs" />
<Compile Include="$(CommonPath)System\Net\WebSockets\WebSocketValidate.cs"
Link="Common\System\Net\WebSockets\WebSocketValidate.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Win32.Primitives" />
<Reference Include="System.Collections.Specialized" />
<Reference Include="System.Collections" />
<Reference Include="System.Memory" />
<Reference Include="System.Net.Primitives" />
<Reference Include="System.Numerics.Vectors" />
Expand Down
Loading