Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Bugfix in bittorrent example
authorSamuel Lepetit <samuel.lepetit@inria.fr>
Mon, 25 Jun 2012 12:05:55 +0000 (14:05 +0200)
committerSamuel Lepetit <samuel.lepetit@inria.fr>
Mon, 25 Jun 2012 12:06:00 +0000 (14:06 +0200)
examples/bittorrent/Common.java
examples/bittorrent/Peer.java
examples/bittorrent/Tracker.java

index 9f15539..5fe91e7 100644 (file)
@@ -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
         */
index 083e92c..1ad6edf 100644 (file)
@@ -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;
index 8f0d7f7..35778b1 100644 (file)
@@ -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);