Skip to content

Commit

Permalink
Fixed regression
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Jan 12, 2024
1 parent c3251a5 commit 40b6f54
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ protected int WriteHeaders(ProtocolStream protocol, in ClusterMemberId sender, i
writer.Write<AppendEntriesMessage>(new(sender, term, prevLogIndex, prevLogTerm, commitIndex, entriesCount));
writer.Add(Unsafe.BitCast<bool, byte>(applyConfig));
writer.Write<ConfigurationMessage>(new(config));
writer.WriteLittleEndian(config.Fingerprint);
writer.WriteLittleEndian(config.Length);
return writer.WrittenCount;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ internal ReceivedLogEntries(ProtocolStream stream, MemoryAllocator<byte> allocat
applyConfig = Unsafe.BitCast<byte, bool>(reader.Read());

var (fingerprint, configLength) = reader.Read<ConfigurationMessage>();
stream.AdvanceReadCursor(reader.ConsumedCount);

Configuration = configLength > 0L
? new(allocator(int.CreateChecked(configLength)), fingerprint)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
namespace DotNext.Net.Cluster.Consensus.Raft.TransportServices.ConnectionOriented;

using Buffers;
using IO;

internal abstract partial class Server : Disposable, IServer
{
Expand Down Expand Up @@ -132,8 +131,6 @@ private async ValueTask AppendEntriesAsync(ProtocolStream protocol, Cancellation
await protocol.ReadAsync(AppendEntriesHeadersSize, token).ConfigureAwait(false);
using (var entries = new ReceivedLogEntries(protocol, BufferAllocator, out var applyConfig, token))
{
protocol.AdvanceReadCursor(AppendEntriesHeadersSize);

// read configuration
var configuration = entries.Configuration.Content;
if (!configuration.IsEmpty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace DotNext.Net.Cluster.Consensus.Raft.TransportServices;
private const byte IdentifierFlag = 0x01;
private const byte SnapshotFlag = IdentifierFlag << 1;

internal readonly long Term;
private readonly long length, timestamp;
private readonly byte flags;
private readonly int identifier;
Expand Down Expand Up @@ -50,8 +51,6 @@ static LogEntryMetadata IBinaryFormattable<LogEntryMetadata>.Parse(ReadOnlySpan<

static int IBinaryFormattable<LogEntryMetadata>.Size => Size;

internal long Term { get; }

internal DateTimeOffset Timestamp => new(timestamp, TimeSpan.Zero);

internal long? Length => length >= 0L ? length : null;
Expand Down

0 comments on commit 40b6f54

Please sign in to comment.