From 33287c781ce29c2ef17887e18c7ae6a0faa10fe1 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Wed, 20 Oct 2021 23:28:35 +0100 Subject: [PATCH] make sure an UploadFinishedEvent always follows an UploadEvent, even if hashlist upload fails --- .../groovy/com/muwire/core/upload/UploadManager.groovy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/groovy/com/muwire/core/upload/UploadManager.groovy b/core/src/main/groovy/com/muwire/core/upload/UploadManager.groovy index 97cb1cd3..4c04bf83 100644 --- a/core/src/main/groovy/com/muwire/core/upload/UploadManager.groovy +++ b/core/src/main/groovy/com/muwire/core/upload/UploadManager.groovy @@ -209,8 +209,11 @@ public class UploadManager { Uploader uploader = new HashListUploader(e, fullInfoHash, request) eventBus.publish(new UploadEvent(uploader : uploader, first: true)) // hash list is always a first try { - uploader.respond() - eventBus.publish(new UploadFinishedEvent(uploader : uploader)) + try { + uploader.respond() + } finally { + eventBus.publish(new UploadFinishedEvent(uploader: uploader)) + } // proceed with content boolean first = true