1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-20 04:47:54 +03:00

Updated to new Arc net

This commit is contained in:
Anuken 2021-07-03 20:27:04 -04:00
parent 0b3dddcc9e
commit 3eb72d6d86
3 changed files with 6 additions and 20 deletions

View File

@ -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<HttpResponse> success, Cons<Throwable> 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);

View File

@ -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

View File

@ -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){