Skip to content

fixed RedisMasterRole. support long type for property replicationOffset for slaves #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions CSRedis/Internal/Commands/RedisRoleCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ static RedisMasterRole ParseMaster(int num, string role, RedisReader reader)
reader.ExpectSize(3, num);
long offset = reader.ReadInt();
reader.ExpectType(RedisMessage.MultiBulk);
var slaves = new Tuple<string, int, int>[reader.ReadInt(false)];
var slaves = new Tuple<string, int, long>[reader.ReadInt(false)];
for (int i = 0; i < slaves.Length; i++)
{
reader.ExpectType(RedisMessage.MultiBulk);
reader.ExpectSize(3);
string ip = reader.ReadBulkString();
int port = Int32.Parse(reader.ReadBulkString());
int slave_offset = Int32.Parse(reader.ReadBulkString());
slaves[i] = new Tuple<string, int, int>(ip, port, slave_offset);
long slave_offset = long.Parse(reader.ReadBulkString());
slaves[i] = new Tuple<string, int, long>(ip, port, slave_offset);
}
return new RedisMasterRole(role, offset, slaves);
}
Expand Down
6 changes: 3 additions & 3 deletions CSRedis/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ internal RedisRole(string roleName)
public class RedisMasterRole : RedisRole
{
readonly long _replicationOffset;
readonly Tuple<string, int, int>[] _slaves;
readonly Tuple<string, int, long>[] _slaves;

/// <summary>
/// Get the master replication offset
Expand All @@ -215,9 +215,9 @@ public class RedisMasterRole : RedisRole
/// <summary>
/// Get the slaves associated with the current master
/// </summary>
public Tuple<string, int, int>[] Slaves { get { return _slaves; } }
public Tuple<string, int, long>[] Slaves { get { return _slaves; } }

internal RedisMasterRole(string role, long replicationOffset, Tuple<string, int, int>[] slaves)
internal RedisMasterRole(string role, long replicationOffset, Tuple<string, int, long>[] slaves)
: base(role)
{
_replicationOffset = replicationOffset;
Expand Down