Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 6 additions & 2 deletions src/core/Akka/IO/TcpIncomingConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,20 @@ protected override ITransportConnection CreateTransport()
var inputPipeOptions = new PipeOptions(
pauseWriterThreshold: pipeBufferSize * 2,
resumeWriterThreshold: pipeBufferSize,
minimumSegmentSize: Settings.MaxFrameSizeBytes,
useSynchronizationContext: false);
var outputPipeOptions = new PipeOptions(
minimumSegmentSize: Settings.MaxFrameSizeBytes,
useSynchronizationContext: false);

if (_stream != null)
{
// Use the provided stream (for TLS or testing)
return new TcpTransportConnection(Socket, _stream, inputPipeOptions: inputPipeOptions);
return new TcpTransportConnection(Socket, _stream, inputPipeOptions: inputPipeOptions, outputPipeOptions: outputPipeOptions);
}

// Default: plaintext TCP using the socket directly
return new TcpTransportConnection(Socket, inputPipeOptions: inputPipeOptions);
return new TcpTransportConnection(Socket, inputPipeOptions: inputPipeOptions, outputPipeOptions: outputPipeOptions);
}

protected override void PreStart()
Expand Down
6 changes: 5 additions & 1 deletion src/core/Akka/IO/TcpOutgoingConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@ protected override ITransportConnection CreateTransport()
var inputPipeOptions = new PipeOptions(
pauseWriterThreshold: pipeBufferSize * 2,
resumeWriterThreshold: pipeBufferSize,
minimumSegmentSize: Settings.MaxFrameSizeBytes,
useSynchronizationContext: false);
var outputPipeOptions = new PipeOptions(
minimumSegmentSize: Settings.MaxFrameSizeBytes,
useSynchronizationContext: false);

return new TcpTransportConnection(Socket, inputPipeOptions: inputPipeOptions);
return new TcpTransportConnection(Socket, inputPipeOptions: inputPipeOptions, outputPipeOptions: outputPipeOptions);
}

private void ReleaseConnectionSocketArgs()
Expand Down
8 changes: 4 additions & 4 deletions src/core/Akka/IO/TcpSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ private TcpSettings(

// fail if send/receive buffer sizes are smaller than max frame size
if (SendBufferSize < MaxFrameSizeBytes)
throw new ArgumentException($"SendBufferSize ({SendBufferSize}) must be at least 2x the size of the maximum frame size ({MaxFrameSizeBytes})");
throw new ArgumentException($"SendBufferSize ({SendBufferSize}) must be at least the size of the maximum frame size ({MaxFrameSizeBytes})");
if (ReceiveBufferSize < MaxFrameSizeBytes)
throw new ArgumentException($"ReceiveBufferSize ({ReceiveBufferSize}) must be at least 2x the size of the maximum frame size ({MaxFrameSizeBytes})");
throw new ArgumentException($"ReceiveBufferSize ({ReceiveBufferSize}) must be at least the size of the maximum frame size ({MaxFrameSizeBytes})");

// fail if the max frame size is negative
if (MaxFrameSizeBytes < 0)
Expand Down Expand Up @@ -178,12 +178,12 @@ public TcpSettings(string bufferPoolConfigPath,
public int MaxFrameSizeBytes { get; init; }

/// <summary>
/// Should be at least 2x the size of the maximum frame size.
/// Should be at least the size of the maximum frame size.
/// </summary>
public int ReceiveBufferSize { get; init; }

/// <summary>
/// Should be at least 2x the size of the maximum frame size.
/// Should be at least the size of the maximum frame size.
/// </summary>
public int SendBufferSize { get; init; }

Expand Down