From cef09b8a2612e53252d044263a7b415f16a431b5 Mon Sep 17 00:00:00 2001 From: Sebastian Hartte Date: Sun, 26 May 2024 01:14:43 +0200 Subject: [PATCH] Add GOAWAY handling --- .../neoforged/neoform/runtime/downloads/DownloadManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/neoforged/neoform/runtime/downloads/DownloadManager.java b/src/main/java/net/neoforged/neoform/runtime/downloads/DownloadManager.java index 9ee7ff6..632da0c 100644 --- a/src/main/java/net/neoforged/neoform/runtime/downloads/DownloadManager.java +++ b/src/main/java/net/neoforged/neoform/runtime/downloads/DownloadManager.java @@ -91,10 +91,13 @@ public boolean download(DownloadSpec spec, Path finalLocation, boolean silent) t try { response = httpClient.send(request, HttpResponse.BodyHandlers.ofFile(partialFile)); } catch (IOException e) { - // We do not have an API to get this information if ("too many concurrent streams".equals(e.getMessage())) { + // We do not have an API to get this limit from the connection and just retry :( waitForRetry(1); continue; + } else if (e.getMessage() != null && e.getMessage().endsWith(" GOAWAY received")) { + // Retry this immediately, since it usually indicates we've reached max requests per connection + continue; } throw e; } catch (InterruptedException e) {