mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
[FIX] Эксперементальный фикс бага с отсутствием реконнекта. (#238)
This commit is contained in:
parent
e172cb194a
commit
91d2690761
1 changed files with 18 additions and 1 deletions
|
@ -9,6 +9,7 @@
|
|||
import ru.gravit.launcher.managers.ClientGsonManager;
|
||||
import ru.gravit.launcher.managers.ConsoleManager;
|
||||
import ru.gravit.launcher.request.Request;
|
||||
import ru.gravit.launcher.request.auth.RestoreSessionRequest;
|
||||
import ru.gravit.launcher.request.websockets.StandartClientWebSocketService;
|
||||
import ru.gravit.utils.helper.CommonHelper;
|
||||
import ru.gravit.utils.helper.EnvHelper;
|
||||
|
@ -71,11 +72,27 @@ public void start(String... args) throws Throwable {
|
|||
if (runtimeProvider == null) runtimeProvider = new JSRuntimeProvider();
|
||||
runtimeProvider.init(false);
|
||||
runtimeProvider.preLoad();
|
||||
if(Request.service != null)
|
||||
if(Request.service == null)
|
||||
{
|
||||
String address = Launcher.getConfig().address;
|
||||
LogHelper.debug("Start async connection to %s", address);
|
||||
Request.service = StandartClientWebSocketService.initWebSockets(address, true);
|
||||
Request.service.reconnectCallback = () ->
|
||||
{
|
||||
LogHelper.debug("WebSocket connect closed. Try reconnect");
|
||||
try {
|
||||
if (!Request.service.reconnectBlocking()) LogHelper.error("Error connecting");
|
||||
LogHelper.debug("Connect to %s", Launcher.getConfig().address);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
RestoreSessionRequest request1 = new RestoreSessionRequest(Request.getSession());
|
||||
request1.request();
|
||||
} catch (Exception e) {
|
||||
LogHelper.error(e);
|
||||
}
|
||||
};
|
||||
}
|
||||
LauncherGuardManager.initGuard(false);
|
||||
Objects.requireNonNull(args, "args");
|
||||
|
|
Loading…
Reference in a new issue