End getPeerNote() on “EndListPeerNotes” message and only store the peer note we’re...
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Thu, 19 Mar 2009 22:05:48 +0000 (23:05 +0100)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Thu, 19 Mar 2009 22:09:11 +0000 (23:09 +0100)
src/net/pterodactylus/fcp/highlevel/FcpClient.java

index a30218e..90ad4da 100644 (file)
@@ -30,6 +30,7 @@ import java.util.concurrent.CountDownLatch;
 import net.pterodactylus.fcp.AddPeer;
 import net.pterodactylus.fcp.ClientHello;
 import net.pterodactylus.fcp.CloseConnectionDuplicateClientName;
+import net.pterodactylus.fcp.EndListPeerNotes;
 import net.pterodactylus.fcp.EndListPeers;
 import net.pterodactylus.fcp.FcpAdapter;
 import net.pterodactylus.fcp.FcpConnection;
@@ -428,7 +429,17 @@ public class FcpClient {
                         */
                        @Override
                        public void receivedPeerNote(FcpConnection fcpConnection, PeerNote peerNote) {
-                               objectWrapper.set(peerNote);
+                               if (peerNote.getNodeIdentifier().equals(peer.getIdentity())) {
+                                       objectWrapper.set(peerNote);
+                               }
+                       }
+
+                       /**
+                        * {@inheritDoc}
+                        */
+                       @Override
+                       public void receivedEndListPeerNotes(FcpConnection fcpConnection, EndListPeerNotes endListPeerNotes) {
+                               completionLatch.countDown();
                        }
                }.execute();
                return objectWrapper.get();