From a28a7e66a1242c96f5f0c20e8e54ac26707d13f9 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Wed, 11 Nov 2020 08:51:22 +0000 Subject: [PATCH] fix showing Failed status if there are no collections --- .../com/muwire/core/collections/CollectionsClient.groovy | 4 ++++ .../com/muwire/core/connection/ConnectionAcceptor.groovy | 3 +++ 2 files changed, 7 insertions(+) diff --git a/core/src/main/groovy/com/muwire/core/collections/CollectionsClient.groovy b/core/src/main/groovy/com/muwire/core/collections/CollectionsClient.groovy index 26109018..8c8fd841 100644 --- a/core/src/main/groovy/com/muwire/core/collections/CollectionsClient.groovy +++ b/core/src/main/groovy/com/muwire/core/collections/CollectionsClient.groovy @@ -55,6 +55,10 @@ class CollectionsClient { InputStream is = endpoint.getInputStream() String code = DataUtil.readTillRN(is) + if (code.startsWith("404")) { + eventBus.publish(new CollectionFetchStatusEvent(status : CollectionFetchStatus.FINISHED, uuid : e.uuid)) + return + } if (!code.startsWith("200")) throw new Exception("invalid code $code") diff --git a/core/src/main/groovy/com/muwire/core/connection/ConnectionAcceptor.groovy b/core/src/main/groovy/com/muwire/core/connection/ConnectionAcceptor.groovy index 7958a205..b60cd85c 100644 --- a/core/src/main/groovy/com/muwire/core/connection/ConnectionAcceptor.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/ConnectionAcceptor.groovy @@ -681,6 +681,9 @@ class ConnectionAcceptor { dos?.flush() dos?.close() } catch (Exception ignore) {} + try { + e.getOutputStream().close() + } catch(Exception ignore) {} e.close() } }