From 8e95f6d5936b720c056042e07d6db4bc3c9a026d Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 10 Apr 2013 23:02:17 +0200 Subject: [PATCH] Only download as much bytes as advertised. --- src/main/java/net/pterodactylus/irc/DccReceiver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/irc/DccReceiver.java b/src/main/java/net/pterodactylus/irc/DccReceiver.java index 038f66a..5c5eac4 100644 --- a/src/main/java/net/pterodactylus/irc/DccReceiver.java +++ b/src/main/java/net/pterodactylus/irc/DccReceiver.java @@ -150,7 +150,7 @@ public class DccReceiver extends AbstractExecutionThreadService { InputStream socketInputStream = socket.getInputStream(); inputStream = new BandwidthCountingInputStream(socketInputStream, 5, TimeUnit.SECONDS); byte[] buffer = new byte[65536]; - while (isRunning()) { + while (isRunning() && ((size == -1) || (progress < size))) { int r = inputStream.read(buffer); if (r == -1) { /* yay, eof! */ -- 2.7.4