Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit 63a8d93

Browse files
committed
enable Nagle algorithm
1 parent e1cf60d commit 63a8d93

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

Titanium.Web.Proxy/Network/TcpConnection.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ internal TcpConnection()
4444

4545
public void Dispose()
4646
{
47+
Stream.Close();
4748
Stream.Dispose();
4849

4950
TcpClient.LingerState = new LingerOption(true, 0);

Titanium.Web.Proxy/Network/TcpConnectionFactory.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ internal async Task<TcpConnection> CreateClient(int bufferSize, int connectionTi
119119

120120
stream.ReadTimeout = connectionTimeOutSeconds * 1000;
121121
stream.WriteTimeout = connectionTimeOutSeconds * 1000;
122-
123-
client.NoDelay = true;
124122

125123
return new TcpConnection()
126124
{
@@ -133,7 +131,5 @@ internal async Task<TcpConnection> CreateClient(int bufferSize, int connectionTi
133131
Version = httpVersion
134132
};
135133
}
136-
137-
138134
}
139135
}

Titanium.Web.Proxy/ProxyServer.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,15 +380,11 @@ private void OnAcceptConnection(IAsyncResult asyn)
380380
}
381381

382382
if (tcpClient != null)
383-
{
384-
383+
{
385384
Task.Run(async () =>
386385
{
387386
try
388-
{
389-
tcpClient.NoDelay = true;
390-
391-
387+
{
392388
if (endPoint.GetType() == typeof(TransparentProxyEndPoint))
393389
{
394390
await HandleClient(endPoint as TransparentProxyEndPoint, tcpClient);

Titanium.Web.Proxy/ResponseHandler.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Threading.Tasks;
88
using Titanium.Web.Proxy.Extensions;
99
using Titanium.Web.Proxy.Http;
10+
using Titanium.Web.Proxy.Helpers;
1011

1112
namespace Titanium.Web.Proxy
1213
{
@@ -214,8 +215,8 @@ private void FixProxyHeaders(Dictionary<string, HttpHeader> headers)
214215
/// <param name="clientStreamReader"></param>
215216
/// <param name="clientStreamWriter"></param>
216217
/// <param name="args"></param>
217-
private void Dispose(Stream clientStream, IDisposable clientStreamReader,
218-
IDisposable clientStreamWriter, IDisposable args)
218+
private void Dispose(Stream clientStream, CustomBinaryReader clientStreamReader,
219+
StreamWriter clientStreamWriter, IDisposable args)
219220
{
220221

221222
if (clientStream != null)
@@ -236,6 +237,7 @@ private void Dispose(Stream clientStream, IDisposable clientStreamReader,
236237

237238
if (clientStreamWriter != null)
238239
{
240+
clientStreamWriter.Close();
239241
clientStreamWriter.Dispose();
240242
}
241243
}

0 commit comments

Comments
 (0)