Skip to content

Commit 41f36ba

Browse files
committed
* No need to start toxiproxy yet
* Use `uint.MinValue` to mean `unlimited` for max frame size *
1 parent ea9cd79 commit 41f36ba

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

.github/workflows/build-test.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ jobs:
2626
run: dotnet format ${{ github.workspace }}/Build.csproj --no-restore --verify-no-changes
2727
- name: Start RabbitMQ
2828
id: start-rabbitmq
29-
run: ${{ github.workspace }}/.ci/ubuntu/gha-setup.sh toxiproxy
29+
# Note: not using toxiproxy yet
30+
# run: ${{ github.workspace }}/.ci/ubuntu/gha-setup.sh toxiproxy
31+
run: ${{ github.workspace }}/.ci/ubuntu/gha-setup.sh
3032
- name: Test
3133
run: dotnet test ${{ github.workspace }}/Build.csproj --no-restore --no-build --logger "console;verbosity=detailed" /p:AltCover=true
3234
- name: Check for errors in RabbitMQ logs
3335
run: ${{ github.workspace}}/.ci/ubuntu/gha-log-check.sh
34-
- name: Maybe collect toxiproxy logs
35-
if: failure()
36-
run: docker logs rabbitmq-amqp-dotnet-client-toxiproxy > ${{ github.workspace }}/.ci/ubuntu/log/toxiproxy.log
36+
# Note: not using toxiproxy yet
37+
# - name: Maybe collect toxiproxy logs
38+
# if: failure()
39+
# run: docker logs rabbitmq-amqp-dotnet-client-toxiproxy > ${{ github.workspace }}/.ci/ubuntu/log/toxiproxy.log
3740
- name: Maybe upload RabbitMQ logs
3841
if: failure()
3942
uses: actions/upload-artifact@v4

RabbitMQ.AMQP.Client/Impl/AmqpConnection.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,18 @@ private async Task EnsureConnection()
198198
var open = new Open
199199
{
200200
HostName = $"vhost:{_connectionSettings.VirtualHost}",
201-
// Note: when set here, there is no need to set cf.AMQP.MaxFrameSize
202-
MaxFrameSize = _connectionSettings.MaxFrameSize,
203201
Properties = new Fields()
204202
{
205203
[new Symbol("connection_name")] = _connectionSettings.ConnectionName,
206204
}
207205
};
208206

207+
if (_connectionSettings.MaxFrameSize > uint.MinValue)
208+
{
209+
// Note: when set here, there is no need to set cf.AMQP.MaxFrameSize
210+
open.MaxFrameSize = _connectionSettings.MaxFrameSize;
211+
}
212+
209213
void onOpened(Amqp.IConnection connection, Open open1)
210214
{
211215
Trace.WriteLine(TraceLevel.Verbose, $"Connection opened. Info: {ToString()}");

RabbitMQ.AMQP.Client/Impl/ConnectionSettings.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,12 @@ public ConnectionSettings(string scheme, string host, int port,
145145
_virtualHost = virtualHost;
146146
_saslMechanism = saslMechanism;
147147

148-
// TODO validate at least 512 bytes
149148
_maxFrameSize = maxFrameSize;
149+
if (_maxFrameSize != uint.MinValue && _maxFrameSize < 512)
150+
{
151+
throw new ArgumentOutOfRangeException(nameof(maxFrameSize),
152+
"maxFrameSize must be greater or equal to 512");
153+
}
150154

151155
_tlsSettings = tlsSettings;
152156

RabbitMQ.AMQP.Client/Impl/Consts.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ public class Consts
66
public const string Key = "key";
77
public const string Queues = "queues";
88
public const string Bindings = "bindings";
9-
public const uint DefaultMaxFrameSize = 256 * 1024; // NOTE: from Azure/amqpnetlite
9+
// public const uint DefaultMaxFrameSize = uint.MinValue; // NOTE: Azure/amqpnetlite uses 256 * 1024
10+
// TODO: change to uint.MinValue when https://github.com/rabbitmq/rabbitmq-server/pull/11843 is merged
11+
public const uint DefaultMaxFrameSize = 256 * 1024;
1012
}

0 commit comments

Comments
 (0)