Skip to content

Commit

Permalink
start supporting quic.
Browse files Browse the repository at this point in the history
  • Loading branch information
wj8400684 committed May 3, 2024
1 parent 83378d1 commit f5f2ce4
Show file tree
Hide file tree
Showing 21 changed files with 710 additions and 5 deletions.
30 changes: 30 additions & 0 deletions SuperSocket.sln
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SuperSocket.Connection", "s
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SuperSocket.Kestrel", "src\SuperSocket.Kestrel\SuperSocket.Kestrel.csproj", "{8C8507D6-903F-4786-8F18-ACA54257454B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SuperSocket.Quic.Connection", "src\SuperSocket.Quic.Connection\SuperSocket.Quic.Connection.csproj", "{29F5C43A-410D-4922-A5C2-E9DDEBF29F9B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SuperSocket.Quic", "src\SuperSocket.Quic\SuperSocket.Quic.csproj", "{BB428AE4-B9F3-414F-823E-58A905E57AE8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -241,6 +245,30 @@ Global
{8C8507D6-903F-4786-8F18-ACA54257454B}.Release|x64.Build.0 = Release|Any CPU
{8C8507D6-903F-4786-8F18-ACA54257454B}.Release|x86.ActiveCfg = Release|Any CPU
{8C8507D6-903F-4786-8F18-ACA54257454B}.Release|x86.Build.0 = Release|Any CPU
{29F5C43A-410D-4922-A5C2-E9DDEBF29F9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{29F5C43A-410D-4922-A5C2-E9DDEBF29F9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{29F5C43A-410D-4922-A5C2-E9DDEBF29F9B}.Debug|x64.ActiveCfg = Debug|Any CPU
{29F5C43A-410D-4922-A5C2-E9DDEBF29F9B}.Debug|x64.Build.0 = Debug|Any CPU
{29F5C43A-410D-4922-A5C2-E9DDEBF29F9B}.Debug|x86.ActiveCfg = Debug|Any CPU
{29F5C43A-410D-4922-A5C2-E9DDEBF29F9B}.Debug|x86.Build.0 = Debug|Any CPU
{29F5C43A-410D-4922-A5C2-E9DDEBF29F9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{29F5C43A-410D-4922-A5C2-E9DDEBF29F9B}.Release|Any CPU.Build.0 = Release|Any CPU
{29F5C43A-410D-4922-A5C2-E9DDEBF29F9B}.Release|x64.ActiveCfg = Release|Any CPU
{29F5C43A-410D-4922-A5C2-E9DDEBF29F9B}.Release|x64.Build.0 = Release|Any CPU
{29F5C43A-410D-4922-A5C2-E9DDEBF29F9B}.Release|x86.ActiveCfg = Release|Any CPU
{29F5C43A-410D-4922-A5C2-E9DDEBF29F9B}.Release|x86.Build.0 = Release|Any CPU
{BB428AE4-B9F3-414F-823E-58A905E57AE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB428AE4-B9F3-414F-823E-58A905E57AE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB428AE4-B9F3-414F-823E-58A905E57AE8}.Debug|x64.ActiveCfg = Debug|Any CPU
{BB428AE4-B9F3-414F-823E-58A905E57AE8}.Debug|x64.Build.0 = Debug|Any CPU
{BB428AE4-B9F3-414F-823E-58A905E57AE8}.Debug|x86.ActiveCfg = Debug|Any CPU
{BB428AE4-B9F3-414F-823E-58A905E57AE8}.Debug|x86.Build.0 = Debug|Any CPU
{BB428AE4-B9F3-414F-823E-58A905E57AE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB428AE4-B9F3-414F-823E-58A905E57AE8}.Release|Any CPU.Build.0 = Release|Any CPU
{BB428AE4-B9F3-414F-823E-58A905E57AE8}.Release|x64.ActiveCfg = Release|Any CPU
{BB428AE4-B9F3-414F-823E-58A905E57AE8}.Release|x64.Build.0 = Release|Any CPU
{BB428AE4-B9F3-414F-823E-58A905E57AE8}.Release|x86.ActiveCfg = Release|Any CPU
{BB428AE4-B9F3-414F-823E-58A905E57AE8}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -262,6 +290,8 @@ Global
{8454E8D5-777D-46CB-B050-76C5119B624B} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{8C8507D6-903F-4786-8F18-ACA54257454B} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{29F5C43A-410D-4922-A5C2-E9DDEBF29F9B} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{BB428AE4-B9F3-414F-823E-58A905E57AE8} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {ADB30AA2-A848-4CB3-8A20-488C80F1BA9E}
Expand Down
52 changes: 52 additions & 0 deletions src/SuperSocket.Quic.Connection/QuicPipeConnection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;
using System.Net;
using System.Net.Quic;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
using SuperSocket.Connection;

#pragma warning disable CA2252

namespace SuperSocket.Quic.Connection
{
public class QuicPipeConnection : StreamPipeConnection
{
private readonly QuicPipeStream _stream;

public QuicPipeConnection(QuicPipeStream stream, EndPoint remoteEndPoint, ConnectionOptions options)
: this(stream, remoteEndPoint, null, options)
{
_stream = stream;
}

public QuicPipeConnection(QuicPipeStream stream, EndPoint remoteEndPoint, EndPoint localEndPoint,
ConnectionOptions options)
: base(stream, remoteEndPoint, localEndPoint, options)
{
_stream = stream;
}

protected override async Task StartInputPipeTask<TPackageInfo>(IObjectPipe<TPackageInfo> packagePipe,
CancellationToken cancellationToken)
{
await _stream.OpenStreamAsync(cancellationToken);
await base.StartInputPipeTask(packagePipe, cancellationToken);
}

protected override bool IsIgnorableException(Exception e)
{
if (base.IsIgnorableException(e))
return true;

switch (e)
{
case QuicException:
case SocketException se when se.IsIgnorableSocketException():
return true;
default:
return false;
}
}
}
}
75 changes: 75 additions & 0 deletions src/SuperSocket.Quic.Connection/QuicPipeStream.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System;
using System.IO;
using System.Net.Quic;
using System.Threading;
using System.Threading.Tasks;

namespace SuperSocket.Quic.Connection;

#pragma warning disable CA2252

public sealed class QuicPipeStream : Stream
{
private Stream _stream;

private readonly bool _serverStream;
private readonly QuicConnection _connection;

public QuicPipeStream(QuicConnection connection, bool serverStream)
{
_connection = connection;
_serverStream = serverStream;
}

public override bool CanRead => _stream.CanRead;
public override bool CanSeek => _stream.CanSeek;
public override bool CanWrite => _stream.CanWrite;
public override long Length => _stream.Length;

public override long Position
{
get => _stream.Position;
set => _stream.Position = value;
}

public async ValueTask OpenStreamAsync(CancellationToken cancellationToken)
{
if (_serverStream)
{
_stream = await _connection.AcceptInboundStreamAsync(cancellationToken);

Check warning on line 39 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This call site is reachable on all platforms. 'QuicConnection.AcceptInboundStreamAsync(CancellationToken)' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 39 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This call site is reachable on all platforms. 'QuicConnection.AcceptInboundStreamAsync(CancellationToken)' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 39 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This call site is reachable on all platforms. 'QuicConnection.AcceptInboundStreamAsync(CancellationToken)' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 39 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This call site is reachable on all platforms. 'QuicConnection.AcceptInboundStreamAsync(CancellationToken)' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 39 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This call site is reachable on all platforms. 'QuicConnection.AcceptInboundStreamAsync(CancellationToken)' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 39 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

This call site is reachable on all platforms. 'QuicConnection.AcceptInboundStreamAsync(CancellationToken)' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 39 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

This call site is reachable on all platforms. 'QuicConnection.AcceptInboundStreamAsync(CancellationToken)' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
}
else
{
_stream = await _connection.OpenOutboundStreamAsync(QuicStreamType.Bidirectional, cancellationToken);

Check warning on line 43 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This call site is reachable on all platforms. 'QuicConnection.OpenOutboundStreamAsync(QuicStreamType, CancellationToken)' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This call site is reachable on all platforms. 'QuicStreamType.Bidirectional' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This call site is reachable on all platforms. 'QuicConnection.OpenOutboundStreamAsync(QuicStreamType, CancellationToken)' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This call site is reachable on all platforms. 'QuicStreamType.Bidirectional' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This call site is reachable on all platforms. 'QuicStreamType.Bidirectional' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This call site is reachable on all platforms. 'QuicConnection.OpenOutboundStreamAsync(QuicStreamType, CancellationToken)' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This call site is reachable on all platforms. 'QuicConnection.OpenOutboundStreamAsync(QuicStreamType, CancellationToken)' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This call site is reachable on all platforms. 'QuicStreamType.Bidirectional' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This call site is reachable on all platforms. 'QuicStreamType.Bidirectional' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This call site is reachable on all platforms. 'QuicConnection.OpenOutboundStreamAsync(QuicStreamType, CancellationToken)' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

This call site is reachable on all platforms. 'QuicConnection.OpenOutboundStreamAsync(QuicStreamType, CancellationToken)' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

This call site is reachable on all platforms. 'QuicStreamType.Bidirectional' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

This call site is reachable on all platforms. 'QuicConnection.OpenOutboundStreamAsync(QuicStreamType, CancellationToken)' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic.Connection/QuicPipeStream.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

This call site is reachable on all platforms. 'QuicStreamType.Bidirectional' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
}
}

public override void Flush() => _stream.Flush();

public override int Read(byte[] buffer, int offset, int count) => _stream.Read(buffer, offset, count);

public override long Seek(long offset, SeekOrigin origin) => _stream.Seek(offset, origin);

public override void SetLength(long value) => _stream.Flush();

public override void Close() => _stream.Close();

public override Task FlushAsync(CancellationToken cancellationToken) => _stream.FlushAsync(cancellationToken);

public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) =>
_stream.ReadAsync(buffer, offset, count, cancellationToken);

public override ValueTask<int> ReadAsync(Memory<byte> buffer,
CancellationToken cancellationToken = default) => _stream.ReadAsync(buffer, cancellationToken);

public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) =>
_stream.WriteAsync(buffer, offset, count, cancellationToken);

public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer,
CancellationToken cancellationToken = default) =>
_stream.WriteAsync(buffer, cancellationToken);

public override void Write(ReadOnlySpan<byte> buffer) => _stream.Flush();

public override void Write(byte[] buffer, int offset, int count) => _stream.Flush();
}
12 changes: 12 additions & 0 deletions src/SuperSocket.Quic.Connection/SuperSocket.Quic.Connection.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>SuperSocket quic connection library.</Description>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\SuperSocket.Connection\SuperSocket.Connection.csproj" />
</ItemGroup>

</Project>
46 changes: 46 additions & 0 deletions src/SuperSocket.Quic/QuicConnectionFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System.Collections.Generic;
using System.IO;
using System.Net.Quic;
using System.Threading;
using System.Threading.Tasks;
using SuperSocket.Connection;
using SuperSocket.Quic.Connection;
using SuperSocket.Server.Abstractions;
using SuperSocket.Server.Abstractions.Connections;

#pragma warning disable CA2252
namespace SuperSocket.Quic
{
internal class QuicConnectionFactory : IConnectionFactory
{
private readonly ListenOptions _listenOptions;
private readonly ConnectionOptions _connectionOptions;
private readonly IEnumerable<IConnectionStreamInitializer> _connectionStreamInitializers;

public QuicConnectionFactory(
IConnectionStreamInitializersFactory connectionStreamInitializersFactory,
ListenOptions listenOptions,
ConnectionOptions connectionOptions)
{
_listenOptions = listenOptions;
_connectionOptions = connectionOptions;
_connectionStreamInitializers = connectionStreamInitializersFactory.Create(_listenOptions);
}

public async Task<IConnection> CreateConnection(object connection, CancellationToken cancellationToken)
{
Stream stream = null;
var quicConnection = connection as QuicConnection;

foreach (var initializer in _connectionStreamInitializers)
{
stream = await initializer.InitializeAsync(quicConnection, cancellationToken);
}

var quicStream = (QuicPipeStream)stream;

return new QuicPipeConnection(quicStream, quicConnection.RemoteEndPoint,

Check warning on line 42 in src/SuperSocket.Quic/QuicConnectionFactory.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This call site is reachable on all platforms. 'QuicConnection.RemoteEndPoint' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 42 in src/SuperSocket.Quic/QuicConnectionFactory.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This call site is reachable on all platforms. 'QuicConnection.RemoteEndPoint' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 42 in src/SuperSocket.Quic/QuicConnectionFactory.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This call site is reachable on all platforms. 'QuicConnection.RemoteEndPoint' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 42 in src/SuperSocket.Quic/QuicConnectionFactory.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

This call site is reachable on all platforms. 'QuicConnection.RemoteEndPoint' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 42 in src/SuperSocket.Quic/QuicConnectionFactory.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

This call site is reachable on all platforms. 'QuicConnection.RemoteEndPoint' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
quicConnection.LocalEndPoint, _connectionOptions);

Check warning on line 43 in src/SuperSocket.Quic/QuicConnectionFactory.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This call site is reachable on all platforms. 'QuicConnection.LocalEndPoint' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic/QuicConnectionFactory.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This call site is reachable on all platforms. 'QuicConnection.LocalEndPoint' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic/QuicConnectionFactory.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This call site is reachable on all platforms. 'QuicConnection.LocalEndPoint' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic/QuicConnectionFactory.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

This call site is reachable on all platforms. 'QuicConnection.LocalEndPoint' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check warning on line 43 in src/SuperSocket.Quic/QuicConnectionFactory.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

This call site is reachable on all platforms. 'QuicConnection.LocalEndPoint' is only supported on: 'linux', 'macOS/OSX', 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
}
}
}
21 changes: 21 additions & 0 deletions src/SuperSocket.Quic/QuicConnectionFactoryBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using SuperSocket.Connection;
using SuperSocket.Server.Abstractions;
using SuperSocket.Server.Abstractions.Connections;

namespace SuperSocket.Quic
{
internal class QuicConnectionFactoryBuilder : IConnectionFactoryBuilder
{
private readonly IConnectionStreamInitializersFactory _connectionStreamInitializersFactory;

public QuicConnectionFactoryBuilder(IConnectionStreamInitializersFactory connectionStreamInitializersFactory)
{
_connectionStreamInitializersFactory = connectionStreamInitializersFactory;
}

public IConnectionFactory Build(ListenOptions listenOptions, ConnectionOptions connectionOptions)
{
return new QuicConnectionFactory(_connectionStreamInitializersFactory,listenOptions, connectionOptions);
}
}
}
Loading

0 comments on commit f5f2ce4

Please sign in to comment.