Skip to content

Commit

Permalink
Use 'in' instead of 'ref readonly'
Browse files Browse the repository at this point in the history
  • Loading branch information
Havret committed Apr 29, 2024
1 parent 157286e commit 2717bfd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/ArtemisNetCoreClient/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private async Task ReceiveLoop()
{
if (_channels.TryGetValue(inboundPacket.ChannelId, out var channel))
{
channel.OnPacket(ref inboundPacket);
channel.OnPacket(inboundPacket);
}
else
{
Expand All @@ -70,7 +70,7 @@ private async Task ReceiveLoop()
}
}

public void OnPacket(ref readonly InboundPacket packet)
public void OnPacket(in InboundPacket packet)
{
switch (packet.PacketType)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ArtemisNetCoreClient/IChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ namespace ActiveMQ.Artemis.Core.Client;

internal interface IChannel
{
void OnPacket(ref readonly InboundPacket packet);
void OnPacket(in InboundPacket packet);
}
10 changes: 5 additions & 5 deletions src/ArtemisNetCoreClient/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public async Task CreateAddressAsync(string address, IEnumerable<RoutingType> ro
private static readonly RoutingType[] AnycastRoutingType = [RoutingType.Anycast];
private static readonly RoutingType[] MulticastRoutingType = [RoutingType.Multicast];

private static RoutingType[] GetRoutingTypes(ref SessionBindingQueryResponseMessage sessionBindingQueryResponseMessage)
private static RoutingType[] GetRoutingTypes(in SessionBindingQueryResponseMessage sessionBindingQueryResponseMessage)
{
return sessionBindingQueryResponseMessage switch
{
Expand Down Expand Up @@ -269,7 +269,7 @@ internal ValueTask RemoveProducerAsync(int producerId)
{
Id = producerId,
};
connection.Send(ref request, ChannelId);
connection.Send(request, ChannelId);
return ValueTask.CompletedTask;
}

Expand Down Expand Up @@ -327,10 +327,10 @@ private async ValueTask CloseAsync()
public void Start()
{
var sessionStart = new SessionStart();
connection.Send(ref sessionStart, ChannelId);
connection.Send(sessionStart, ChannelId);
}

public void OnPacket(ref readonly InboundPacket packet)
public void OnPacket(in InboundPacket packet)
{
switch (packet.PacketType)
{
Expand All @@ -350,7 +350,7 @@ public void OnPacket(ref readonly InboundPacket packet)
if (_completionSources.TryRemove(-1, out var tcs))
{
var result = response.Exists
? new AddressInfo { QueueNames = response.QueueNames, RoutingTypes = GetRoutingTypes(ref response) }
? new AddressInfo { QueueNames = response.QueueNames, RoutingTypes = GetRoutingTypes(response) }
: _emptyResult;
tcs.TrySetResult(result);
}
Expand Down

0 comments on commit 2717bfd

Please sign in to comment.