From: David ‘Bombe’ Roden Date: Thu, 11 Apr 2013 20:17:05 +0000 (+0200) Subject: Remove downloads when they have finished, too. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=5773cb3843f156f4fbe33443baa8faf50b9a4fb2;p=xudocci.git Remove downloads when they have finished, too. --- diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index 248f765..7a35624 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -409,6 +409,7 @@ public class Core extends AbstractIdleService { file.renameTo(new File(finalDirectory, download.pack().name())); eventBus.post(new DownloadFinished(download)); dccReceivers.remove(dccDownloadFinished.dccReceiver()); + downloads.remove(download); } catch (IOException ioe1) { /* TODO - handle all the errors. */ logger.log(Level.WARNING, String.format("Could not move file %s to directory %s.", download.filename(), finalDirectory), ioe1); @@ -433,6 +434,7 @@ public class Core extends AbstractIdleService { Closeables.close(download.outputStream(), true); eventBus.post(new DownloadFailed(download)); dccReceivers.remove(dccDownloadFailed.dccReceiver()); + downloads.remove(download); } catch (IOException ioe1) { /* swallow silently. */ }