Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix bug raised by rriemann.
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 5 Jul 2016 07:38:15 +0000 (09:38 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 5 Jul 2016 07:38:15 +0000 (09:38 +0200)
examples/java/app/bittorrent/Tracker.java
examples/java/app/bittorrent/app_bittorrent.tesh

index c6a1862..980d9c6 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2014, 2026. The SimGrid Team.
+/* Copyright (c) 2006-2014, 2016. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -54,7 +54,7 @@ public class Tracker extends Process {
               int nextPeer;
               do {
                 nextPeer = stream.randInt(0, peersList.size() - 1);
               int nextPeer;
               do {
                 nextPeer = stream.randInt(0, peersList.size() - 1);
-              } while (tTask.peers.contains(nextPeer));
+              } while (tTask.peers.contains(peersList.get(nextPeer)));
               tTask.peers.add(peersList.get(nextPeer));
               nbPeers++;
             }
               tTask.peers.add(peersList.get(nextPeer));
               nbPeers++;
             }
index 06e2845..b6662d0 100644 (file)
@@ -17,8 +17,8 @@ $ java -classpath ${classpath:=.} app/bittorrent/Main ${srcdir:=.}/../platforms/
 > [node-4.acme.org:app.bittorrent.Peer:(5) 0.000000] [jmsg/INFO] Hi, I'm joining the network with id 5
 > [node-4.acme.org:app.bittorrent.Peer:(5) 5000.007806] [jmsg/INFO] Here is my current status: 1111111111
 > [node-5.acme.org:app.bittorrent.Peer:(6) 0.000000] [jmsg/INFO] Hi, I'm joining the network with id 6
 > [node-4.acme.org:app.bittorrent.Peer:(5) 0.000000] [jmsg/INFO] Hi, I'm joining the network with id 5
 > [node-4.acme.org:app.bittorrent.Peer:(5) 5000.007806] [jmsg/INFO] Here is my current status: 1111111111
 > [node-5.acme.org:app.bittorrent.Peer:(6) 0.000000] [jmsg/INFO] Hi, I'm joining the network with id 6
-> [node-5.acme.org:app.bittorrent.Peer:(6) 5000.039030] [jmsg/INFO] Here is my current status: 1111111111
+> [node-5.acme.org:app.bittorrent.Peer:(6) 5000.023418] [jmsg/INFO] Here is my current status: 1111111111
 > [node-6.acme.org:app.bittorrent.Peer:(7) 0.000000] [jmsg/INFO] Hi, I'm joining the network with id 7
 > [node-6.acme.org:app.bittorrent.Peer:(7) 0.000000] [jmsg/INFO] Hi, I'm joining the network with id 7
-> [node-6.acme.org:app.bittorrent.Peer:(7) 5000.031224] [jmsg/INFO] Here is my current status: 1111111111
+> [node-6.acme.org:app.bittorrent.Peer:(7) 5000.046836] [jmsg/INFO] Here is my current status: 1111111111
 > [node-7.acme.org:app.bittorrent.Peer:(8) 0.000000] [jmsg/INFO] Hi, I'm joining the network with id 8
 > [node-7.acme.org:app.bittorrent.Peer:(8) 0.000000] [jmsg/INFO] Hi, I'm joining the network with id 8
-> [node-7.acme.org:app.bittorrent.Peer:(8) 5000.046836] [jmsg/INFO] Here is my current status: 1111111111
+> [node-7.acme.org:app.bittorrent.Peer:(8) 5000.031224] [jmsg/INFO] Here is my current status: 1111111111