From 3eb72d6d86f1ccdbc10ce502a155b8ddcfb86657 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 3 Jul 2021 20:27:04 -0400 Subject: [PATCH] Updated to new Arc net --- core/src/mindustry/net/CrashSender.java | 20 ++++---------------- gradle.properties | 2 +- tests/src/test/java/GenericModTest.java | 4 +--- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/core/src/mindustry/net/CrashSender.java b/core/src/mindustry/net/CrashSender.java index d045a83a5c..fb84190307 100644 --- a/core/src/mindustry/net/CrashSender.java +++ b/core/src/mindustry/net/CrashSender.java @@ -147,26 +147,18 @@ public class CrashSender{ ex(() -> value.addChild("javaVersion", new JsonValue(System.getProperty("java.version")))); ex(() -> value.addChild("javaArch", new JsonValue(System.getProperty("sun.arch.data.model")))); - boolean[] sent = {false}; - Log.info("Sending crash report."); + //post to crash report URL, exit code indicates send success - httpPost(Vars.crashReportURL, value.toJson(OutputType.json), r -> { + new arc.Net().http(new HttpRequest().block(true).method(HttpMethod.POST).content(value.toJson(OutputType.json)).url(Vars.crashReportURL), r -> { Log.info("Crash sent successfully."); - sent[0] = true; System.exit(1); }, t -> { - t.printStackTrace(); - sent[0] = true; + Log.info("Crash report not sent."); System.exit(-1); }); - //sleep until report is sent - try{ - while(!sent[0]){ - Thread.sleep(30); - } - }catch(InterruptedException ignored){} + ret(); }catch(Throwable death){ death.printStackTrace(); } @@ -178,10 +170,6 @@ public class CrashSender{ System.exit(1); } - private static void httpPost(String url, String content, Cons success, Cons failure){ - new NetJavaImpl().http(new HttpRequest().method(HttpMethod.POST).content(content).url(url), success, failure); - } - private static String parseException(Throwable e){ StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); diff --git a/gradle.properties b/gradle.properties index e07a747c11..bf99697a47 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=1142cfc35b6671c6a2c5566632ff044a46527b82 +archash=41de08d2d3c2f415e1965b66cf9aab3c9950477d diff --git a/tests/src/test/java/GenericModTest.java b/tests/src/test/java/GenericModTest.java index f703d53873..621b4d2f0f 100644 --- a/tests/src/test/java/GenericModTest.java +++ b/tests/src/test/java/GenericModTest.java @@ -14,9 +14,7 @@ public class GenericModTest{ static void grabMod(String url){ //clear older mods ApplicationTests.testDataFolder.deleteDirectory(); - Core.net = new Net(); - Core.net.setBlock(true); - Core.net.http(new HttpRequest().url(url).method(HttpMethod.GET), httpResponse -> { + new Net().http(new HttpRequest().block(true).url(url).method(HttpMethod.GET), httpResponse -> { try{ ApplicationTests.testDataFolder.child("mods").child("test_mod." + (url.endsWith("jar") ? "jar" : "zip")).writeBytes(Streams.copyBytes(httpResponse.getResultAsStream())); }catch(IOException e){