X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Ffcp%2Fquelaton%2FListPeersCommandImpl.java;h=c084cb59cab2623290d4570c3dcd95649114a842;hb=e3f3a4323df8d53a0a59c2e4369abbcd8d60b940;hp=5638b98504d161e40977dea555ddc64ce1156dcc;hpb=e7fe15a311e143a2154bfc62ed21cdf591b9a27f;p=jFCPlib.git diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/ListPeersCommandImpl.java b/src/main/java/net/pterodactylus/fcp/quelaton/ListPeersCommandImpl.java index 5638b98..c084cb5 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/ListPeersCommandImpl.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/ListPeersCommandImpl.java @@ -11,6 +11,7 @@ import net.pterodactylus.fcp.EndListPeers; import net.pterodactylus.fcp.ListPeers; import net.pterodactylus.fcp.Peer; +import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; @@ -23,6 +24,8 @@ public class ListPeersCommandImpl implements ListPeersCommand { private final ListeningExecutorService threadPool; private final ConnectionSupplier connectionSupplier; + private final AtomicBoolean includeMetadata = new AtomicBoolean(false); + private final AtomicBoolean includeVolatile = new AtomicBoolean(false); public ListPeersCommandImpl(ExecutorService threadPool, ConnectionSupplier connectionSupplier) { this.threadPool = MoreExecutors.listeningDecorator(threadPool); @@ -30,9 +33,21 @@ public class ListPeersCommandImpl implements ListPeersCommand { } @Override - public Future> execute() { + public ListPeersCommand includeMetadata() { + includeMetadata.set(true); + return this; + } + + @Override + public ListPeersCommand includeVolatile() { + includeVolatile.set(true); + return this; + } + + @Override + public ListenableFuture> execute() { String identifier = new RandomIdentifierGenerator().generate(); - ListPeers listPeers = new ListPeers(identifier); + ListPeers listPeers = new ListPeers(identifier, includeMetadata.get(), includeVolatile.get()); return threadPool.submit(() -> new ListPeersReplySequence().send(listPeers).get()); }