Skip to content

Commit

Permalink
Improving the request of tasks of TaskManager (2x) (#900)
Browse files Browse the repository at this point in the history
  • Loading branch information
yongjiema authored and erikzhang committed Aug 6, 2019
1 parent be17769 commit d083132
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion neo/Network/P2P/TaskManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ private void RequestTasks(TaskSession session)
return;
}
}
if ((!HasHeaderTask || globalTasks[HeaderTaskHash] < MaxConncurrentTasks) && Blockchain.Singleton.HeaderHeight < session.Version.StartHeight)
if ((!HasHeaderTask || globalTasks[HeaderTaskHash] < MaxConncurrentTasks)
&& (Blockchain.Singleton.HeaderHeight < session.Version.StartHeight
|| (Blockchain.Singleton.Height == Blockchain.Singleton.HeaderHeight
&& Blockchain.Singleton.HeaderHeight >= sessions.Select(x => x.Value.Version.StartHeight).Max()
&& TimeProvider.Current.UtcNow.ToTimestamp() - 60 >= Blockchain.Singleton.GetBlock(Blockchain.Singleton.CurrentHeaderHash)?.Timestamp)))
{
session.Tasks[HeaderTaskHash] = DateTime.UtcNow;
IncrementGlobalTask(HeaderTaskHash);
Expand Down

0 comments on commit d083132

Please sign in to comment.