Skip to content

Commit

Permalink
refactory for SuperSocket
Browse files Browse the repository at this point in the history
  • Loading branch information
kerryjiang committed Mar 17, 2024
1 parent 76ad533 commit ab7e45d
Show file tree
Hide file tree
Showing 194 changed files with 1,484 additions and 1,041 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- 2refactory

jobs:
build:
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dotnet.defaultSolution": "SuperSocket.sln"
}
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<Import Project="Dependencies.props" />
<PropertyGroup>
<LangVersion>8.0</LangVersion>
<LangVersion>10.0</LangVersion>
<TargetFrameworks>netstandard2.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<SamplesTargetFrameworks>net7.0</SamplesTargetFrameworks>
</PropertyGroup>
Expand Down
73 changes: 29 additions & 44 deletions SuperSocket.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DDA4741E-097
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Primitives", "src\SuperSocket.Primitives\SuperSocket.Primitives.csproj", "{A1317CCC-70F4-4F32-84DE-2AAF68E346D2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Channel", "src\SuperSocket.Channel\SuperSocket.Channel.csproj", "{829C73CC-6166-4DF8-9FAF-18B55E15D5B2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.ProtoBase", "src\SuperSocket.ProtoBase\SuperSocket.ProtoBase.csproj", "{7EE705BE-5645-451B-B5A2-50408F63A222}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Server", "src\SuperSocket.Server\SuperSocket.Server.csproj", "{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3}"
Expand All @@ -25,8 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.WebSocket", "sr
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.WebSocket.Server", "src\SuperSocket.WebSocket.Server\SuperSocket.WebSocket.Server.csproj", "{4E9A4A13-0F74-4325-803A-351447336859}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.SessionContainer", "src\SuperSocket.SessionContainer\SuperSocket.SessionContainer.csproj", "{46618C5F-987D-40B3-B882-1C4895001D61}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Client.Proxy", "src\SuperSocket.Client.Proxy\SuperSocket.Client.Proxy.csproj", "{62BC2056-F454-4E7A-86E5-1C2E866145AB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Tests.Command", "test\SuperSocket.Tests.Command\SuperSocket.Tests.Command.csproj", "{A68F2204-5021-4657-AACC-971FEBA385EB}"
Expand All @@ -37,7 +33,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Benchmarks", "t
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Udp", "src\SuperSocket.Udp\SuperSocket.Udp.csproj", "{695AA5D6-62C6-4D7E-8023-967CF134E26C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.GZip", "src\SuperSocket.GZip\SuperSocket.GZip.csproj", "{DEF97D4F-01BC-49E5-8B8B-D23C6652F80F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SuperSocket.Server.Abstractions", "src\SuperSocket.Server.Abstractions\SuperSocket.Server.Abstractions.csproj", "{8454E8D5-777D-46CB-B050-76C5119B624B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SuperSocket.Connection", "src\SuperSocket.Connection\SuperSocket.Connection.csproj", "{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -61,18 +59,6 @@ Global
{A1317CCC-70F4-4F32-84DE-2AAF68E346D2}.Release|x64.Build.0 = Release|Any CPU
{A1317CCC-70F4-4F32-84DE-2AAF68E346D2}.Release|x86.ActiveCfg = Release|Any CPU
{A1317CCC-70F4-4F32-84DE-2AAF68E346D2}.Release|x86.Build.0 = Release|Any CPU
{829C73CC-6166-4DF8-9FAF-18B55E15D5B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{829C73CC-6166-4DF8-9FAF-18B55E15D5B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{829C73CC-6166-4DF8-9FAF-18B55E15D5B2}.Debug|x64.ActiveCfg = Debug|Any CPU
{829C73CC-6166-4DF8-9FAF-18B55E15D5B2}.Debug|x64.Build.0 = Debug|Any CPU
{829C73CC-6166-4DF8-9FAF-18B55E15D5B2}.Debug|x86.ActiveCfg = Debug|Any CPU
{829C73CC-6166-4DF8-9FAF-18B55E15D5B2}.Debug|x86.Build.0 = Debug|Any CPU
{829C73CC-6166-4DF8-9FAF-18B55E15D5B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{829C73CC-6166-4DF8-9FAF-18B55E15D5B2}.Release|Any CPU.Build.0 = Release|Any CPU
{829C73CC-6166-4DF8-9FAF-18B55E15D5B2}.Release|x64.ActiveCfg = Release|Any CPU
{829C73CC-6166-4DF8-9FAF-18B55E15D5B2}.Release|x64.Build.0 = Release|Any CPU
{829C73CC-6166-4DF8-9FAF-18B55E15D5B2}.Release|x86.ActiveCfg = Release|Any CPU
{829C73CC-6166-4DF8-9FAF-18B55E15D5B2}.Release|x86.Build.0 = Release|Any CPU
{7EE705BE-5645-451B-B5A2-50408F63A222}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7EE705BE-5645-451B-B5A2-50408F63A222}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7EE705BE-5645-451B-B5A2-50408F63A222}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -157,18 +143,6 @@ Global
{4E9A4A13-0F74-4325-803A-351447336859}.Release|x64.Build.0 = Release|Any CPU
{4E9A4A13-0F74-4325-803A-351447336859}.Release|x86.ActiveCfg = Release|Any CPU
{4E9A4A13-0F74-4325-803A-351447336859}.Release|x86.Build.0 = Release|Any CPU
{46618C5F-987D-40B3-B882-1C4895001D61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46618C5F-987D-40B3-B882-1C4895001D61}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46618C5F-987D-40B3-B882-1C4895001D61}.Debug|x64.ActiveCfg = Debug|Any CPU
{46618C5F-987D-40B3-B882-1C4895001D61}.Debug|x64.Build.0 = Debug|Any CPU
{46618C5F-987D-40B3-B882-1C4895001D61}.Debug|x86.ActiveCfg = Debug|Any CPU
{46618C5F-987D-40B3-B882-1C4895001D61}.Debug|x86.Build.0 = Debug|Any CPU
{46618C5F-987D-40B3-B882-1C4895001D61}.Release|Any CPU.ActiveCfg = Release|Any CPU
{46618C5F-987D-40B3-B882-1C4895001D61}.Release|Any CPU.Build.0 = Release|Any CPU
{46618C5F-987D-40B3-B882-1C4895001D61}.Release|x64.ActiveCfg = Release|Any CPU
{46618C5F-987D-40B3-B882-1C4895001D61}.Release|x64.Build.0 = Release|Any CPU
{46618C5F-987D-40B3-B882-1C4895001D61}.Release|x86.ActiveCfg = Release|Any CPU
{46618C5F-987D-40B3-B882-1C4895001D61}.Release|x86.Build.0 = Release|Any CPU
{62BC2056-F454-4E7A-86E5-1C2E866145AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{62BC2056-F454-4E7A-86E5-1C2E866145AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62BC2056-F454-4E7A-86E5-1C2E866145AB}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -229,39 +203,50 @@ Global
{695AA5D6-62C6-4D7E-8023-967CF134E26C}.Release|x64.Build.0 = Release|Any CPU
{695AA5D6-62C6-4D7E-8023-967CF134E26C}.Release|x86.ActiveCfg = Release|Any CPU
{695AA5D6-62C6-4D7E-8023-967CF134E26C}.Release|x86.Build.0 = Release|Any CPU
{DEF97D4F-01BC-49E5-8B8B-D23C6652F80F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DEF97D4F-01BC-49E5-8B8B-D23C6652F80F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEF97D4F-01BC-49E5-8B8B-D23C6652F80F}.Debug|x64.ActiveCfg = Debug|Any CPU
{DEF97D4F-01BC-49E5-8B8B-D23C6652F80F}.Debug|x64.Build.0 = Debug|Any CPU
{DEF97D4F-01BC-49E5-8B8B-D23C6652F80F}.Debug|x86.ActiveCfg = Debug|Any CPU
{DEF97D4F-01BC-49E5-8B8B-D23C6652F80F}.Debug|x86.Build.0 = Debug|Any CPU
{DEF97D4F-01BC-49E5-8B8B-D23C6652F80F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEF97D4F-01BC-49E5-8B8B-D23C6652F80F}.Release|Any CPU.Build.0 = Release|Any CPU
{DEF97D4F-01BC-49E5-8B8B-D23C6652F80F}.Release|x64.ActiveCfg = Release|Any CPU
{DEF97D4F-01BC-49E5-8B8B-D23C6652F80F}.Release|x64.Build.0 = Release|Any CPU
{DEF97D4F-01BC-49E5-8B8B-D23C6652F80F}.Release|x86.ActiveCfg = Release|Any CPU
{DEF97D4F-01BC-49E5-8B8B-D23C6652F80F}.Release|x86.Build.0 = Release|Any CPU
{8454E8D5-777D-46CB-B050-76C5119B624B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8454E8D5-777D-46CB-B050-76C5119B624B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8454E8D5-777D-46CB-B050-76C5119B624B}.Debug|x64.ActiveCfg = Debug|Any CPU
{8454E8D5-777D-46CB-B050-76C5119B624B}.Debug|x64.Build.0 = Debug|Any CPU
{8454E8D5-777D-46CB-B050-76C5119B624B}.Debug|x86.ActiveCfg = Debug|Any CPU
{8454E8D5-777D-46CB-B050-76C5119B624B}.Debug|x86.Build.0 = Debug|Any CPU
{8454E8D5-777D-46CB-B050-76C5119B624B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8454E8D5-777D-46CB-B050-76C5119B624B}.Release|Any CPU.Build.0 = Release|Any CPU
{8454E8D5-777D-46CB-B050-76C5119B624B}.Release|x64.ActiveCfg = Release|Any CPU
{8454E8D5-777D-46CB-B050-76C5119B624B}.Release|x64.Build.0 = Release|Any CPU
{8454E8D5-777D-46CB-B050-76C5119B624B}.Release|x86.ActiveCfg = Release|Any CPU
{8454E8D5-777D-46CB-B050-76C5119B624B}.Release|x86.Build.0 = Release|Any CPU
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}.Debug|x64.ActiveCfg = Debug|Any CPU
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}.Debug|x64.Build.0 = Debug|Any CPU
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}.Debug|x86.ActiveCfg = Debug|Any CPU
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}.Debug|x86.Build.0 = Debug|Any CPU
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}.Release|Any CPU.Build.0 = Release|Any CPU
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}.Release|x64.ActiveCfg = Release|Any CPU
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}.Release|x64.Build.0 = Release|Any CPU
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}.Release|x86.ActiveCfg = Release|Any CPU
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A1317CCC-70F4-4F32-84DE-2AAF68E346D2} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{829C73CC-6166-4DF8-9FAF-18B55E15D5B2} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{7EE705BE-5645-451B-B5A2-50408F63A222} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56} = {4040EEC4-6FB7-47B1-B487-23E043A0F52F}
{E9B31C8C-EC67-486B-9972-F6B4452BF050} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{E1C29FC7-8A20-4811-94A5-0B80F1632E9D} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{D648690B-1D08-4B8D-A299-681938B128F2} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{4E9A4A13-0F74-4325-803A-351447336859} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{46618C5F-987D-40B3-B882-1C4895001D61} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{62BC2056-F454-4E7A-86E5-1C2E866145AB} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{A68F2204-5021-4657-AACC-971FEBA385EB} = {4040EEC4-6FB7-47B1-B487-23E043A0F52F}
{1C563726-BBB3-4D2D-B426-6C1A72A5B959} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{4DFB226C-2D1A-4346-B984-468A523209AF} = {4040EEC4-6FB7-47B1-B487-23E043A0F52F}
{695AA5D6-62C6-4D7E-8023-967CF134E26C} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{DEF97D4F-01BC-49E5-8B8B-D23C6652F80F} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{8454E8D5-777D-46CB-B050-76C5119B624B} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {ADB30AA2-A848-4CB3-8A20-488C80F1BA9E}
Expand Down
3 changes: 3 additions & 0 deletions samples/AspNetSample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using SuperSocket;
using SuperSocket.Server;
using SuperSocket.Server.Host;
using SuperSocket.Server.Abstractions.Session;
using SuperSocket.ProtoBase;
using System.Text;

Expand Down
1 change: 1 addition & 0 deletions samples/CommandServer/ADD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Text;
using System.Threading.Tasks;
using SuperSocket;
using SuperSocket.Server.Abstractions.Session;
using SuperSocket.Command;
using SuperSocket.ProtoBase;

Expand Down
1 change: 1 addition & 0 deletions samples/CommandServer/MULT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Text;
using System.Threading.Tasks;
using SuperSocket;
using SuperSocket.Server.Abstractions.Session;
using SuperSocket.Command;
using SuperSocket.ProtoBase;

Expand Down
3 changes: 3 additions & 0 deletions samples/CommandServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using SuperSocket;
using SuperSocket.Server;
using SuperSocket.Server.Host;
using SuperSocket.Server.Abstractions.Session;
using SuperSocket.Command;
using SuperSocket.ProtoBase;

Expand Down
1 change: 1 addition & 0 deletions samples/CommandServer/SUB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Text;
using System.Threading.Tasks;
using SuperSocket;
using SuperSocket.Server.Abstractions.Session;
using SuperSocket.Command;
using SuperSocket.ProtoBase;

Expand Down
1 change: 1 addition & 0 deletions samples/ConfigSample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using SuperSocket;
using SuperSocket.Server.Host;
using SuperSocket.ProtoBase;

namespace ConfigSample
Expand Down
3 changes: 3 additions & 0 deletions samples/CustomProtocol/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using SuperSocket;
using SuperSocket.Server;
using SuperSocket.Server.Abstractions;
using SuperSocket.Server.Host;
using SuperSocket.ProtoBase;

namespace CustomProtocol
Expand Down
3 changes: 3 additions & 0 deletions samples/EchoServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using SuperSocket;
using SuperSocket.Server;
using SuperSocket.Server.Abstractions;
using SuperSocket.Server.Host;
using SuperSocket.ProtoBase;

namespace EchoServer
Expand Down
5 changes: 5 additions & 0 deletions samples/WebSocketPushServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
using Microsoft.Extensions.Logging;
using SuperSocket;
using SuperSocket.Server;
using SuperSocket.Server.Abstractions;
using SuperSocket.Server.Abstractions.Host;
using SuperSocket.Server.Abstractions.Session;
using SuperSocket.Server.Abstractions.Middleware;
using SuperSocket.Server.Host;
using SuperSocket.WebSocket.Server;

namespace WebSocketPushServer
Expand Down
2 changes: 1 addition & 1 deletion samples/WebSocketPushServer/PushSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using SuperSocket;
using SuperSocket.Server;
using SuperSocket.WebSocket.Server;
using SuperSocket.SessionContainer;
using SuperSocket.Server.Abstractions.Session;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.DependencyInjection;

Expand Down
4 changes: 3 additions & 1 deletion samples/WebSocketPushServer/ServerPushMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
using System.Linq;
using SuperSocket;
using SuperSocket.Server;
using SuperSocket.Server.Abstractions;
using SuperSocket.Server.Abstractions.Session;
using SuperSocket.Server.Abstractions.Middleware;
using SuperSocket.WebSocket.Server;
using SuperSocket.SessionContainer;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.DependencyInjection;

Expand Down
3 changes: 1 addition & 2 deletions samples/WebSocketPushServer/WebSocketPushServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<TargetFrameworks>$(SamplesTargetFrameworks)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\SuperSocket.WebSocket.Server\SuperSocket.WebSocket.Server.csproj" />
<ProjectReference Include="..\..\src\SuperSocket.SessionContainer\SuperSocket.SessionContainer.csproj" />
<ProjectReference Include="..\..\src\SuperSocket.WebSocket.Server\SuperSocket.WebSocket.Server.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.json">
Expand Down
26 changes: 0 additions & 26 deletions src/SuperSocket.Channel/SslStreamPipeChannel.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/SuperSocket.Client.Proxy/HttpConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using SuperSocket.Channel;
using SuperSocket.Connection;
using SuperSocket.ProtoBase;

namespace SuperSocket.Client.Proxy
Expand Down Expand Up @@ -33,7 +33,7 @@ protected override async ValueTask<ConnectState> ConnectProxyAsync(EndPoint remo
{
var encoding = Encoding.ASCII;
var request = string.Empty;
var channel = state.CreateChannel<TextPackageInfo>(new LinePipelineFilter(encoding), new ChannelOptions { ReadAsDemand = true });
var channel = state.CreateConnection<TextPackageInfo>(new LinePipelineFilter(encoding), new ConnectionOptions { ReadAsDemand = true });

channel.Start();

Expand Down
2 changes: 1 addition & 1 deletion src/SuperSocket.Client.Proxy/ProxyConnectorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using SuperSocket.Channel;
using SuperSocket.Connection;
using SuperSocket.Client;
using SuperSocket.ProtoBase;

Expand Down
22 changes: 11 additions & 11 deletions src/SuperSocket.Client.Proxy/Socks5Connector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using SuperSocket.Channel;
using SuperSocket.Connection;
using SuperSocket.Client;
using SuperSocket.ProtoBase;

Expand Down Expand Up @@ -39,19 +39,19 @@ public Socks5Connector(EndPoint proxyEndPoint, string username, string password)

protected override async ValueTask<ConnectState> ConnectProxyAsync(EndPoint remoteEndPoint, ConnectState state, CancellationToken cancellationToken)
{
var channel = state.CreateChannel<Socks5Pack>(new Socks5AuthPipelineFilter(), new ChannelOptions { ReadAsDemand = true });
var connection = state.CreateConnection<Socks5Pack>(new Socks5AuthPipelineFilter(), new ConnectionOptions { ReadAsDemand = true });

channel.Start();
connection.Start();

var packStream = channel.GetPackageStream();
var packStream = connection.GetPackageStream();

await channel.SendAsync(_authenHandshakeRequest);
await connection.SendAsync(_authenHandshakeRequest);

var response = await packStream.ReceiveAsync();

if (!HandleResponse(response, Socket5ResponseType.Handshake, out string errorMessage))
{
await channel.CloseAsync(CloseReason.ProtocolError);
await connection.CloseAsync(CloseReason.ProtocolError);

return new ConnectState
{
Expand All @@ -64,13 +64,13 @@ protected override async ValueTask<ConnectState> ConnectProxyAsync(EndPoint remo
{
var passAuthenRequest = GetPassAuthenBytes();

await channel.SendAsync(passAuthenRequest);
await connection.SendAsync(passAuthenRequest);

response = await packStream.ReceiveAsync();

if (!HandleResponse(response, Socket5ResponseType.AuthUserName, out errorMessage))
{
await channel.CloseAsync(CloseReason.ProtocolError);
await connection.CloseAsync(CloseReason.ProtocolError);

return new ConnectState
{
Expand All @@ -82,13 +82,13 @@ protected override async ValueTask<ConnectState> ConnectProxyAsync(EndPoint remo

var endPointRequest = GetEndPointBytes(remoteEndPoint);

await channel.SendAsync(endPointRequest);
await connection.SendAsync(endPointRequest);

response = await packStream.ReceiveAsync();

if (!HandleResponse(response, Socket5ResponseType.AuthEndPoint, out errorMessage))
{
await channel.CloseAsync(CloseReason.ProtocolError);
await connection.CloseAsync(CloseReason.ProtocolError);

return new ConnectState
{
Expand All @@ -97,7 +97,7 @@ protected override async ValueTask<ConnectState> ConnectProxyAsync(EndPoint remo
};
}

await channel.DetachAsync();
await connection.DetachAsync();

return state;
}
Expand Down
Loading

0 comments on commit ab7e45d

Please sign in to comment.