From 6f07f2a2696cf881ba0ff5cc2361ca22c29d57ee Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Thu, 26 Apr 2018 14:35:13 +0200 Subject: [PATCH] I see brain overload ... --- examples/java/app/bittorrent/Peer.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/java/app/bittorrent/Peer.java b/examples/java/app/bittorrent/Peer.java index 978619f869..9188edd11b 100644 --- a/examples/java/app/bittorrent/Peer.java +++ b/examples/java/app/bittorrent/Peer.java @@ -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; } -- 2.20.1