Remove downloads when they have finished, too.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 11 Apr 2013 20:17:05 +0000 (22:17 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 11 Apr 2013 20:17:05 +0000 (22:17 +0200)
src/main/java/net/pterodactylus/xdcc/core/Core.java

index 248f765..7a35624 100644 (file)
@@ -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. */
                }