From: Samuel Lepetit Date: Mon, 25 Jun 2012 12:05:55 +0000 (+0200) Subject: Bugfix in bittorrent example X-Git-Tag: v3_9_90~569^2~19^2~34 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/9a70319084dc5c9e13be59bb0554775a91431cd4?hp=bf026049e57d9d6b2825306506ee9f5b7e476677 Bugfix in bittorrent example --- diff --git a/examples/bittorrent/Common.java b/examples/bittorrent/Common.java index 9f155399dd..5fe91e77d0 100644 --- a/examples/bittorrent/Common.java +++ b/examples/bittorrent/Common.java @@ -17,7 +17,7 @@ public class Common { /** * Max number of pairs sent by the tracker to clients */ - public static int MAXIMUM_PAIRS = 50; + public static int MAXIMUM_PEERS = 50; /** * Interval of time where the peer should send a request to the tracker */ diff --git a/examples/bittorrent/Peer.java b/examples/bittorrent/Peer.java index 083e92c8fd..1ad6edf25c 100644 --- a/examples/bittorrent/Peer.java +++ b/examples/bittorrent/Peer.java @@ -328,7 +328,7 @@ public class Peer extends Process { Msg.debug("My status is now " + getStatus()); //Sending the information to all the peers we are connected to sendHave(message.index); - //sending UNINTERSTED to peers that doesn't have what we want. + //sending UNINTERESTED to peers that doesn't have what we want. updateInterestedAfterReceive(); } else { @@ -443,7 +443,8 @@ public class Peer extends Process { peerChoosed = null; } j++; - } while (peerChoosed == null && j < Common.MAXIMUM_PAIRS); + } while (peerChoosed == null && j < +Common.MAXIMUM_PEERS); if (peerChoosed != null) { activePeers.put(peerChoosed.id,peerChoosed); peerChoosed.chokedUpload = false; diff --git a/examples/bittorrent/Tracker.java b/examples/bittorrent/Tracker.java index 8f0d7f79fb..35778b15b8 100644 --- a/examples/bittorrent/Tracker.java +++ b/examples/bittorrent/Tracker.java @@ -57,7 +57,7 @@ public class Tracker extends Process { TrackerTask tTask = (TrackerTask)task; //Sending peers to the peer int nbPeers = 0; - while (nbPeers < Common.MAXIMUM_PAIRS && nbPeers < peersList.size()) { + while (nbPeers < Common.MAXIMUM_PEERS && nbPeers < peersList.size()) { int nextPeer; do { nextPeer = stream.randInt(0, peersList.size() - 1);