X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fxdcc%2Fcore%2FCore.java;h=9d5dcb7a9877c7bf63805d599a03ee652e137fc6;hb=db7e9612fa189cee9f4b9086e00d87c4d6c58bbf;hp=3c3e4578168bf02376af4eb227b8ca01578cf04e;hpb=c0bc71bd241cb16659b07b1d83204f21af0c7695;p=xudocci.git diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index 3c3e457..9d5dcb7 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -583,7 +583,7 @@ public class Core extends AbstractExecutionThreadService { } /* remove download. */ - downloads.remove(download); + downloads.remove(download.pack().name()); return; } @@ -630,7 +630,7 @@ public class Core extends AbstractExecutionThreadService { eventBus.post(new GenericError(String.format("Download %s from %s does not start at the right position!"))); logger.log(Level.WARNING, String.format("Download %s from %s: have %d bytes but wants to resume from %d!", dccAcceptReceived.filename(), dccAcceptReceived.source(), outputFile.length(), dccAcceptReceived.position())); - downloads.remove(download); + downloads.remove(download.pack().name()); return; } OutputStream outputStream = new FileOutputStream(outputFile, true); @@ -664,7 +664,7 @@ public class Core extends AbstractExecutionThreadService { file.renameTo(new File(finalDirectory, download.pack().name())); eventBus.post(new DownloadFinished(download)); dccReceivers.remove(dccDownloadFinished.dccReceiver()); - downloads.remove(download); + downloads.remove(download.pack().name()); } 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); @@ -689,7 +689,7 @@ public class Core extends AbstractExecutionThreadService { Closeables.close(download.outputStream(), true); eventBus.post(new DownloadFailed(download)); dccReceivers.remove(dccDownloadFailed.dccReceiver()); - downloads.remove(download); + downloads.remove(download.pack().name()); } catch (IOException ioe1) { /* swallow silently. */ }