Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/JDbg/TcpTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public TcpTransport(string hostname, int port, OnPacket onPacket, OnDisconnect o

_client = new TcpClient();
_client.NoDelay = true;
_client.ReceiveBufferSize = 2048;
_client.SendBufferSize = 2048;
_client.ReceiveBufferSize = 65536;
_client.SendBufferSize = 65536;
_client.ReceiveTimeout = 0;
_client.SendTimeout = 30000;
_client.LingerState = new LingerOption(true, 30);
Expand Down
2 changes: 1 addition & 1 deletion src/MICore/Transports/PipeTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected virtual void InitProcess(Process proc, out StreamReader stdout, out St
_debuggerPid = _process.Id;
stdout = _process.StandardOutput;
// Creating a new stream writer to set encoding to UTF-8 with UTF8Identifier as false. This prevents sending Byte Order Mask within the stream.
stdin = new StreamWriter(_process.StandardInput.BaseStream, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), 1024 /* note: this is the default buffer size in the BCL */, leaveOpen: true);
stdin = new StreamWriter(_process.StandardInput.BaseStream, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), 65536 /* note: this is the default buffer size in the BCL */, leaveOpen: true);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this comment is no longer true so it should be deleted: /* note: this is the default buffer size in the BCL */

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

_stdErrReader = _process.StandardError;
_remainingReaders = 2;

Expand Down
8 changes: 4 additions & 4 deletions src/MICore/Transports/TcpTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ public override void InitStreams(LaunchOptions options, out StreamReader reader,
);
// Starting with .NET Framework 4.7, this method authenticates using None, which allows the operating system to choose the best protocol to use, and to block protocols that are not secure.
sslStream.AuthenticateAsClientAsync(tcpOptions.Hostname, certStore.Certificates, System.Security.Authentication.SslProtocols.None, false /* checkCertificateRevocation */).Wait();
reader = new StreamReader(sslStream);
writer = new StreamWriter(sslStream);
reader = new StreamReader(sslStream, Encoding.UTF8, false, 65536);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value 65536 is now mentioned in multiple locations in the code, I suggest that it should be a named constant instead, used everywhere. This helps the next reader understand that these values are the same intentionally, not by accident.

writer = new StreamWriter(sslStream, Encoding.UTF8, 65536);
}
else
{
reader = new StreamReader(_client.GetStream());
writer = new StreamWriter(_client.GetStream());
reader = new StreamReader(_client.GetStream(), Encoding.UTF8, false, 65536);
writer = new StreamWriter(_client.GetStream(), Encoding.UTF8, 65536);
}
}

Expand Down