Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[InitialSeeding] Only choke/unchoke if there's a pending unchoke.

We don't need to choke peers if there's no-one waiting to take the
slot.
  • Loading branch information...
commit b2c6f44d2776f9c5dbe03250d14cc8be3e1139da 1 parent ed4175c
@alanmcgovern alanmcgovern authored
Showing with 10 additions and 10 deletions.
  1. +10 −10 src/MonoTorrent/MonoTorrent.Client/Unchokers/InitialSeedUnchoker.cs
View
20 src/MonoTorrent/MonoTorrent.Client/Unchokers/InitialSeedUnchoker.cs
@@ -271,15 +271,16 @@ void TryUnchoke(ChokeData data)
public override void UnchokeReview()
{
- List<ChokeData> dupePieces = new List<ChokeData>(peers);
- foreach (ChokeData data in dupePieces)
- TryChoke(data);
-
- List<ChokeData> dupe = new List<ChokeData>(peers);
-
- // See if there's anyone interesting to unchoke
- foreach (ChokeData data in dupe)
- TryUnchoke(data);
+ if (PendingUnchoke) {
+ List<ChokeData> dupePeers = new List<ChokeData>(peers);
+ foreach (ChokeData data in dupePieces)
+ TryChoke(data);
+
+ dupePeers = new List<ChokeData>(peers);
+ // See if there's anyone interesting to unchoke
+ foreach (ChokeData data in dupePieces)
+ TryUnchoke(data);
+ }
// Make sure our list of pieces available in the swarm is up to date
foreach (ChokeData data in peers)
@@ -290,7 +291,6 @@ public override void UnchokeReview()
// Send have messages to anyone that needs them
foreach (ChokeData data in peers)
TryAdvertisePiece(data);
-
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.