mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-01-09 00:59:44 +03:00
[FIX] ExitResponse
This commit is contained in:
parent
886c085572
commit
4d17f34ba6
1 changed files with 4 additions and 4 deletions
|
@ -5,6 +5,7 @@
|
||||||
import pro.gravit.launcher.ClientPermissions;
|
import pro.gravit.launcher.ClientPermissions;
|
||||||
import pro.gravit.launcher.events.RequestEvent;
|
import pro.gravit.launcher.events.RequestEvent;
|
||||||
import pro.gravit.launcher.events.request.ExitRequestEvent;
|
import pro.gravit.launcher.events.request.ExitRequestEvent;
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.socket.Client;
|
import pro.gravit.launchserver.socket.Client;
|
||||||
import pro.gravit.launchserver.socket.handlers.WebSocketFrameHandler;
|
import pro.gravit.launchserver.socket.handlers.WebSocketFrameHandler;
|
||||||
import pro.gravit.launchserver.socket.response.SimpleResponse;
|
import pro.gravit.launchserver.socket.response.SimpleResponse;
|
||||||
|
@ -46,7 +47,7 @@ public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
} else {
|
} else {
|
||||||
if (client1.session != client.session) return;
|
if (client1.session != client.session) return;
|
||||||
}
|
}
|
||||||
exit(webSocketFrameHandler, channel, ExitRequestEvent.ExitReason.SERVER);
|
exit(server, webSocketFrameHandler, channel, ExitRequestEvent.ExitReason.SERVER);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
sendResult(new ExitRequestEvent(ExitRequestEvent.ExitReason.CLIENT));
|
sendResult(new ExitRequestEvent(ExitRequestEvent.ExitReason.CLIENT));
|
||||||
|
@ -55,17 +56,16 @@ public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
Client client1 = webSocketFrameHandler.getClient();
|
Client client1 = webSocketFrameHandler.getClient();
|
||||||
if(client1 != null && client.isAuth && client.username != null && client1.username.equals(username))
|
if(client1 != null && client.isAuth && client.username != null && client1.username.equals(username))
|
||||||
{
|
{
|
||||||
exit(webSocketFrameHandler, channel, ExitRequestEvent.ExitReason.SERVER);
|
exit(server, webSocketFrameHandler, channel, ExitRequestEvent.ExitReason.SERVER);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
sendResult(new ExitRequestEvent(ExitRequestEvent.ExitReason.NO_EXIT));
|
sendResult(new ExitRequestEvent(ExitRequestEvent.ExitReason.NO_EXIT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void exit(WebSocketFrameHandler wsHandler, Channel channel, ExitRequestEvent.ExitReason reason)
|
public static void exit(LaunchServer server, WebSocketFrameHandler wsHandler, Channel channel, ExitRequestEvent.ExitReason reason)
|
||||||
{
|
{
|
||||||
|
|
||||||
Client chClient = wsHandler.getClient();
|
Client chClient = wsHandler.getClient();
|
||||||
if (!chClient.isAuth || !username.equals(chClient.username)) return;
|
|
||||||
Client newCusClient = new Client(null);
|
Client newCusClient = new Client(null);
|
||||||
newCusClient.checkSign = chClient.checkSign;
|
newCusClient.checkSign = chClient.checkSign;
|
||||||
wsHandler.setClient(newCusClient);
|
wsHandler.setClient(newCusClient);
|
||||||
|
|
Loading…
Reference in a new issue