Skip to content

Commit

Permalink
fixed a build error in client proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
kerryjiang committed Mar 24, 2024
1 parent 6f49766 commit c5fce4a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/SuperSocket.Client.Proxy/HttpConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ protected override async ValueTask<ConnectState> ConnectProxyAsync(EndPoint remo
{
var encoding = Encoding.ASCII;
var request = string.Empty;
var channel = state.CreateConnection<TextPackageInfo>(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)
{
Expand All @@ -55,7 +55,7 @@ protected override async ValueTask<ConnectState> ConnectProxyAsync(EndPoint remo
}

// send request
await channel.SendAsync((writer) =>
await connection.SendAsync((writer) =>
{
writer.Write(request, encoding);

Expand All @@ -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
{
Expand All @@ -85,7 +84,7 @@ await channel.SendAsync((writer) =>
};
}

await channel.DetachAsync();
await connection.DetachAsync();
return state;
}

Expand Down

0 comments on commit c5fce4a

Please sign in to comment.