Skip to content

Commit 4607e42

Browse files
Specify message terminator only once
1 parent 64b4e6d commit 4607e42

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Runtime/Core/BcpServer.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ private set
6767
private readonly ManualResetEventSlim disconnectRequested = new(false);
6868
private readonly int port;
6969

70+
private const char terminator = '\n';
71+
7072
private enum ReceiveEndReason
7173
{
7274
Finished,
@@ -203,7 +205,6 @@ CancellationToken ct
203205

204206
var stringRead = Encoding.UTF8.GetString(byteBuffer, 0, numBytesRead);
205207
stringBuffer.Append(stringRead);
206-
const char terminator = '\n';
207208
int messageLength;
208209
while (
209210
!ct.IsCancellationRequested
@@ -234,7 +235,7 @@ private async Task SendMessagesAsync(NetworkStream stream, CancellationToken ct)
234235
)
235236
{
236237
var stringMessage = bcpMessage.ToString(encode: true);
237-
stringMessage += "\n";
238+
stringMessage += terminator;
238239
var packet = Encoding.UTF8.GetBytes(stringMessage);
239240
try
240241
{

0 commit comments

Comments
 (0)