From: David ‘Bombe’ Roden Date: Fri, 10 Jul 2015 12:56:58 +0000 (+0200) Subject: Don’t verify the identifier twice X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=441daa1bc76eac976829d76da2c7bf2dc8f6d754;p=jFCPlib.git Don’t verify the identifier twice --- diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/ClientGetCommandImpl.java b/src/main/java/net/pterodactylus/fcp/quelaton/ClientGetCommandImpl.java index 4439cce..8e24cbf 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/ClientGetCommandImpl.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/ClientGetCommandImpl.java @@ -109,7 +109,6 @@ class ClientGetCommandImpl implements ClientGetCommand { private class ClientGetReplySequence extends FcpReplySequence> { - private final AtomicReference identifier = new AtomicReference<>(); private final AtomicBoolean finished = new AtomicBoolean(); private final AtomicBoolean failed = new AtomicBoolean(); @@ -148,32 +147,22 @@ class ClientGetCommandImpl implements ClientGetCommand { @Override protected void consumeAllData(AllData allData) { - if (allData.getIdentifier().equals(identifier.get())) { - synchronized (this) { - contentType = allData.getContentType(); - dataLength = allData.getDataLength(); - try { - payload = new TempInputStream(allData.getPayloadInputStream(), dataLength); - finished.set(true); - } catch (IOException e) { - // TODO – logging - failed.set(true); - } + synchronized (this) { + contentType = allData.getContentType(); + dataLength = allData.getDataLength(); + try { + payload = new TempInputStream(allData.getPayloadInputStream(), dataLength); + finished.set(true); + } catch (IOException e) { + // TODO – logging + failed.set(true); } } } @Override protected void consumeGetFailed(GetFailed getFailed) { - if (getFailed.getIdentifier().equals(identifier.get())) { - failed.set(true); - } - } - - @Override - public ListenableFuture> send(FcpMessage fcpMessage) throws IOException { - identifier.set(fcpMessage.getField("Identifier")); - return super.send(fcpMessage); + failed.set(true); } }