Skip to content
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

Fix/Improve syncing (3x): Adding ping mechanism to TaskManager for replacing StartHeight and PendingKnownHashes strategy #899

Merged
merged 33 commits into from
Dec 1, 2019
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
99ca3f2
Drop the duplicate NewTasks for the TaskManagerMailbox
yongjiema Jul 9, 2019
2048e7b
Try to get headers from remote nodes if the current header is not upd…
yongjiema Jul 9, 2019
079a74b
Merge branch 'master' into fix-sync-stuck
shargon Jul 9, 2019
755ab15
Update TaskManager.cs
shargon Jul 9, 2019
4ed0e22
Update TaskManager.cs
shargon Jul 9, 2019
4b410ad
Merge branch 'master' into fix-sync-stuck
vncoelho Jul 11, 2019
64dd8bd
Merge branch 'master' into fix-sync-stuck
shargon Jul 30, 2019
58d2ff0
Merge branch 'master' into fix-sync-stuck
vncoelho Aug 7, 2019
9e271e1
Merge branch 'master' into fix-sync-stuck
vncoelho Aug 9, 2019
7b32b10
Merge branch 'master' into fix-sync-stuck
shargon Aug 10, 2019
ae46f80
Merge branch 'master' into fix-sync-stuck
shargon Aug 12, 2019
70b2072
Merge branch 'master' into fix-sync-stuck
vncoelho Aug 12, 2019
b44e1eb
Try to get headers from remote nodes even the current header height i…
yongjiema Aug 13, 2019
bf01bab
Correct the timestamp usage according to NEO3
yongjiema Aug 16, 2019
261e7ff
Merge branch 'master' into fix-sync-stuck
erikzhang Aug 18, 2019
152a7cb
Merge branch 'master' into fix-sync-stuck
vncoelho Aug 19, 2019
cd5cb5f
Merge branch 'master' into fix-sync-stuck
vncoelho Aug 28, 2019
692a9ad
Merge branch 'master' into fix-sync-stuck
vncoelho Sep 24, 2019
11e811c
Merge branch 'master' into fix-sync-stuck
lock9 Sep 26, 2019
8196dff
Improve syncing
yongjiema Sep 29, 2019
0e21d78
Merge branch 'master' into fix-sync-stuck
vncoelho Oct 23, 2019
bd3b3fc
Merge branch 'master' into fix-sync-stuck
vncoelho Nov 4, 2019
fe2d98a
Merge branch 'master' into fix-sync-stuck
vncoelho Nov 10, 2019
100b30d
Merge branch 'master' into fix-sync-stuck
vncoelho Nov 13, 2019
ebe25e2
Merge branch 'master' into fix-sync-stuck
vncoelho Nov 13, 2019
fd0e712
Merge branch 'master' into fix-sync-stuck
lock9 Nov 13, 2019
9a73bf8
Merge branch 'master' into fix-sync-stuck
erikzhang Nov 25, 2019
04fdfa8
Update ProtocolHandler.cs
erikzhang Nov 25, 2019
1d985e0
Update ProtocolHandler.cs
erikzhang Nov 25, 2019
daf7141
move projects
erikzhang Nov 26, 2019
75f4470
Merge branch 'master' into fix-sync-stuck
erikzhang Nov 26, 2019
e18184e
Merge branch 'master' into fix-sync-stuck
vncoelho Nov 29, 2019
98f11f8
Merge branch 'master' into fix-sync-stuck
erikzhang Dec 1, 2019
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
14 changes: 7 additions & 7 deletions neo/Network/P2P/ProtocolHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ internal class ProtocolHandler : UntypedActor
public class SetFilter { public BloomFilter Filter; }
internal class Timer { }

private class PendingKnownHashesCollection : KeyedCollection<UInt256, KeyValuePair<UInt256, DateTime>>
private class PendingKnownHashesCollection : KeyedCollection<UInt256, (UInt256, DateTime)>
{
protected override UInt256 GetKeyForItem(KeyValuePair<UInt256, DateTime> item)
protected override UInt256 GetKeyForItem((UInt256, DateTime) item)
{
return item.Key;
return item.Item1;
}
}

Expand Down Expand Up @@ -314,7 +314,7 @@ private void OnInvMessageReceived(InvPayload payload)
}
if (hashes.Length == 0) return;
foreach (UInt256 hash in hashes)
pendingKnownHashes.Add(new KeyValuePair<UInt256, DateTime>(hash, DateTime.UtcNow));
pendingKnownHashes.Add((hash, DateTime.UtcNow));
system.TaskManager.Tell(new TaskManager.NewTasks { Payload = InvPayload.Create(payload.Type, hashes) }, Context.Parent);
}

Expand Down Expand Up @@ -362,10 +362,10 @@ private void RefreshPendingKnownHashes()
{
while (pendingKnownHashes.Count > 0)
{
KeyValuePair<UInt256, DateTime> item = pendingKnownHashes.First();
if (DateTime.UtcNow - item.Value <= PendingTimeout)
var (hash, time) = pendingKnownHashes[0];
if (DateTime.UtcNow - time <= PendingTimeout)
break;
pendingKnownHashes.Remove(item);
pendingKnownHashes.Remove(hash);
}
}

Expand Down