X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Ffcp%2Fquelaton%2FDefaultFcpClient.java;h=1d7c02c2365065a7909e63498ec7c6806643a2ce;hb=207d6e210e81e7dfa3fb7931aecbfe1d251f6c7c;hp=42522e049f7d73e05ce85060ca81f059cd2522fe;hpb=1ce220842b96db2ea57e456c70977620943cb5de;p=jFCPlib.git diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/DefaultFcpClient.java b/src/main/java/net/pterodactylus/fcp/quelaton/DefaultFcpClient.java index 42522e0..1d7c02c 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/DefaultFcpClient.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/DefaultFcpClient.java @@ -27,15 +27,12 @@ public class DefaultFcpClient implements FcpClient { private final int port; private final AtomicReference fcpConnection = new AtomicReference<>(); private final Supplier clientName; - private final Supplier expectedVersion; - public DefaultFcpClient(ExecutorService threadPool, String hostname, int port, Supplier clientName, - Supplier expectedVersion) { + public DefaultFcpClient(ExecutorService threadPool, String hostname, int port, Supplier clientName) { this.threadPool = MoreExecutors.listeningDecorator(threadPool); this.hostname = hostname; this.port = port; this.clientName = clientName; - this.expectedVersion = expectedVersion; } private FcpConnection connect() throws IOException { @@ -52,7 +49,7 @@ public class DefaultFcpClient implements FcpClient { FcpConnection connection = new FcpConnection(hostname, port); connection.connect(); FcpReplySequence nodeHelloSequence = new ClientHelloReplySequence(connection); - ClientHello clientHello = new ClientHello(clientName.get(), expectedVersion.get()); + ClientHello clientHello = new ClientHello(clientName.get(), "2.0"); try { nodeHelloSequence.send(clientHello).get(); } catch (InterruptedException | ExecutionException e) { @@ -77,6 +74,11 @@ public class DefaultFcpClient implements FcpClient { return new ClientPutCommandImpl(threadPool, this::connect); } + @Override + public ListPeersCommand listPeers() { + return new ListPeersCommandImpl(threadPool, this::connect); + } + private class ClientHelloReplySequence extends FcpReplySequence { private final AtomicReference receivedNodeHello;