From fd9ba37dd309acf886edbd65dc347bc4ca832e04 Mon Sep 17 00:00:00 2001 From: zaxar163 Date: Fri, 4 Jan 2019 11:10:41 +0400 Subject: [PATCH] Protocol of updater fix. --- .../ru/gravit/launchserver/UpdateManager.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/UpdateManager.java b/LaunchServer/src/main/java/ru/gravit/launchserver/UpdateManager.java index 08049d5d..7de0fe2f 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/UpdateManager.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/UpdateManager.java @@ -1,7 +1,6 @@ package ru.gravit.launchserver; import java.io.IOException; -import java.net.MalformedURLException; import java.net.Socket; import java.util.Timer; import java.util.TimerTask; @@ -53,20 +52,19 @@ public void run() { s.getOutputStream().write(2); @SuppressWarnings("resource") // s.close() closes it. HInput in = new HInput(s.getInputStream()); - if (in.readBoolean()) { - int num = in.readInt(); - for (int i = 0; i < num; i++) { - if (i >= lastNum) { - String classN = in.readString(1024); - byte[] classB = in.readByteArray(256*1024); - try { - Callback c = (Callback)cl.define(classN, classB).newInstance(); - c.prep(srv); - c.define(cl); - c.post(srv); - } catch (InstantiationException | IllegalAccessException e) { - LogHelper.error(e); - } + int num = in.readInt(); + if (num == lastNum) return; + for (int i = 0; i < num; i++) { + if (i >= lastNum) { + String classN = in.readString(1024); + byte[] classB = in.readByteArray(256*1024); + try { + Callback c = (Callback)cl.define(classN, classB).newInstance(); + c.prep(srv); + c.define(cl); + c.post(srv); + } catch (InstantiationException | IllegalAccessException e) { + LogHelper.error(e); } } if (num != lastNum) lastNum = num;