Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
I see brain overload ...
[simgrid.git] / examples / java / app / bittorrent / Peer.java
index 8c07d84..9188edd 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2014, 2016-2017. The SimGrid Team.
+/* Copyright (c) 2006-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -178,16 +178,15 @@ public class Peer extends Process {
 
   private boolean getPeersData() {
     boolean success = false;
-    boolean sendSuccess = false;
     double timeout = Msg.getClock() + Common.GET_PEERS_TIMEOUT;
     //Build the task to send to the tracker
     TrackerTask taskSend = new TrackerTask(hostname, mailboxTracker, id);
 
-    while (!sendSuccess && Msg.getClock() < timeout) {
+    while (Msg.getClock() < timeout) {
       try {
         Msg.debug("Sending a peer request to the tracker.");
         taskSend.send(Common.TRACKER_MAILBOX,Common.GET_PEERS_TIMEOUT);
-        sendSuccess = true;
+        break;
       }
       catch (MsgException e) {
         e.printStackTrace();
@@ -212,7 +211,6 @@ public class Peer extends Process {
       }
       commReceived = null;
     }
-    commReceived = null;
     return success;
   }