From c5fce4ac394261285d8da3982d04066a9602b854 Mon Sep 17 00:00:00 2001 From: Kerry Jiang Date: Sat, 23 Mar 2024 17:51:17 -0700 Subject: [PATCH] fixed a build error in client proxy --- src/SuperSocket.Client.Proxy/HttpConnector.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/SuperSocket.Client.Proxy/HttpConnector.cs b/src/SuperSocket.Client.Proxy/HttpConnector.cs index 12011e254..717f1d65c 100644 --- a/src/SuperSocket.Client.Proxy/HttpConnector.cs +++ b/src/SuperSocket.Client.Proxy/HttpConnector.cs @@ -33,9 +33,9 @@ protected override async ValueTask ConnectProxyAsync(EndPoint remo { var encoding = Encoding.ASCII; var request = string.Empty; - var channel = state.CreateConnection(new LinePipelineFilter(encoding), new ConnectionOptions { ReadAsDemand = true }); + var connection = state.CreateConnection(new ConnectionOptions { ReadAsDemand = true }); - channel.Start(); + var packStream = connection.GetPackageStream(new LinePipelineFilter(encoding)); if (remoteEndPoint is DnsEndPoint dnsEndPoint) { @@ -55,7 +55,7 @@ protected override async ValueTask ConnectProxyAsync(EndPoint remo } // send request - await channel.SendAsync((writer) => + await connection.SendAsync((writer) => { writer.Write(request, encoding); @@ -70,13 +70,12 @@ await channel.SendAsync((writer) => writer.Write("\r\n", encoding); } }); - - var packStream = channel.GetPackageStream(); + var p = await packStream.ReceiveAsync(); if (!HandleResponse(p, out string errorMessage)) { - await channel.CloseAsync(CloseReason.ProtocolError); + await connection.CloseAsync(CloseReason.ProtocolError); return new ConnectState { @@ -85,7 +84,7 @@ await channel.SendAsync((writer) => }; } - await channel.DetachAsync(); + await connection.DetachAsync(); return state; }