X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Ffcp%2Fquelaton%2FDefaultFcpClient.java;h=09b154bee7af29ed180e562be05fcebf20ccb8b0;hb=ebede056b159ea34d294f3fac0e2def790454a48;hp=8d2afc0a5a06f22aa4bfbf56e11f108100d94e90;hpb=e3f3a4323df8d53a0a59c2e4369abbcd8d60b940;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 8d2afc0..09b154b 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/DefaultFcpClient.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/DefaultFcpClient.java @@ -33,11 +33,11 @@ public class DefaultFcpClient implements FcpClient { private FcpConnection connect() throws IOException { FcpConnection fcpConnection = this.fcpConnection.get(); - if (fcpConnection != null) { + if ((fcpConnection != null) && !fcpConnection.isClosed()) { return fcpConnection; } fcpConnection = createConnection(); - this.fcpConnection.compareAndSet(null, fcpConnection); + this.fcpConnection.set(fcpConnection); return fcpConnection; } @@ -70,9 +70,24 @@ public class DefaultFcpClient implements FcpClient { } @Override + public ListPeerCommand listPeer() { + return new ListPeerCommandImpl(threadPool, this::connect); + } + + @Override public ListPeersCommand listPeers() { return new ListPeersCommandImpl(threadPool, this::connect); } + @Override + public AddPeerCommand addPeer() { + return new AddPeerCommandImpl(threadPool, this::connect); + } + + @Override + public ListPeerNotesCommand listPeerNotes() { + return new ListPeerNotesCommandImpl(threadPool, this::connect); + } + }