Skip to content

Commit

Permalink
Ignore received time of late delta
Browse files Browse the repository at this point in the history
  • Loading branch information
longfin committed May 8, 2019
1 parent bd38510 commit c3cd022
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Libplanet/Net/Swarm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1354,8 +1354,17 @@ CancellationToken cancellationToken
_logger.Debug($"Trying to apply the delta[{delta}]...");
await ApplyDelta(delta, cancellationToken);

LastReceived = delta.Timestamp;
LastSeenTimestamps[delta.Sender] = delta.Timestamp;
bool alreadyReceived =
LastSeenTimestamps.TryGetValue(
delta.Sender,
out DateTimeOffset existingTimestamp) &&
existingTimestamp > delta.Timestamp;

if (!alreadyReceived)
{
LastReceived = delta.Timestamp;
LastSeenTimestamps[delta.Sender] = delta.Timestamp;
}

DeltaReceived.Set();
}
Expand Down

0 comments on commit c3cd022

Please sign in to comment.