Skip to content

Commit

Permalink
Update service protocol (#2127)
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Sindo authored Jan 20, 2025
1 parent 52cd40b commit 6e4f3a7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Microsoft.Azure.SignalR.Protocols/ServiceMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ public class GroupMemberQueryMessage : ExtensibleServiceMessage, IAckableMessage
/// <summary>
/// The max count of connections to return.
/// </summary>
public int Max { get; set; } = 200;
public int? Top { get; set; }

/// <summary>
/// A token to indiate the start point of results.
Expand Down
11 changes: 9 additions & 2 deletions src/Microsoft.Azure.SignalR.Protocols/ServiceProtocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,14 @@ private static void WriteGroupMemberQueryMessage(ref MessagePackWriter writer, G
message.WriteExtensionMembers(ref writer);
writer.Write(message.GroupName);
writer.Write(message.AckId);
writer.Write(message.Max);
if (message.Top != null)
{
writer.Write(message.Top.Value);
}
else
{
writer.WriteNil();
}
writer.Write(message.ContinuationToken);
}

Expand Down Expand Up @@ -1394,7 +1401,7 @@ private static GroupMemberQueryMessage CreateGroupMemberQueryMessage(ref Message
result.ReadExtensionMembers(ref reader);
result.GroupName = ReadStringNotNull(ref reader, nameof(GroupMemberQueryMessage.GroupName));
result.AckId = ReadInt32(ref reader, nameof(GroupMemberQueryMessage.AckId));
result.Max = ReadInt32(ref reader, nameof(GroupMemberQueryMessage.Max));
result.Top = reader.TryReadNil() ? null : ReadInt32(ref reader, nameof(GroupMemberQueryMessage.Top));
result.ContinuationToken = ReadString(ref reader, nameof(GroupMemberQueryMessage.ContinuationToken));
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ private bool GroupMemberQueryMessageEqual(GroupMemberQueryMessage x, GroupMember
{
return x.AckId == y.AckId &&
StringEqual(x.GroupName, y.GroupName) &&
x.Max == y.Max &&
x.Top == y.Top &&
StringEqual(x.ContinuationToken, y.ContinuationToken) &&
x.TracingId == y.TracingId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,11 @@ public static IEnumerable<object[]> TestParseOldData
binary: "lSelY29ubjLSAAAAAtIAAAAEgA=="),
new ProtocolTestData(
name: "GroupMemberQueryMessage",
message: new GroupMemberQueryMessage() { GroupName = "group", AckId = 1, Max = 10, ContinuationToken = "token", TracingId = 1234UL },
message: new GroupMemberQueryMessage() { GroupName = "group", AckId = 1 },
binary: "liiApWdyb3VwAcDA"),
new ProtocolTestData(
name: "GroupMemberQueryMessageWithOptionalFields",
message: new GroupMemberQueryMessage() { GroupName = "group", AckId = 1, Top = 10, ContinuationToken = "token", TracingId = 1234UL },
binary: "liiBAc0E0qVncm91cAEKpXRva2Vu"),
}.ToDictionary(t => t.Name);

Expand Down

0 comments on commit 6e4f3a7

Please sign in to comment.