From d1bc03664beddc17658f6633733162fd04dc93eb Mon Sep 17 00:00:00 2001 From: BartolomeoDR Date: Sat, 16 Oct 2021 14:27:48 +0300 Subject: [PATCH 1/2] Update Client.java Added ability to customize refCount value of a client --- .../main/java/pro/gravit/launchserver/socket/Client.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/Client.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/Client.java index 4ce6a1ad..382496c8 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/Client.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/Client.java @@ -36,9 +36,14 @@ public class Client { public Map serializableProperties; - public transient AtomicInteger refCount = new AtomicInteger(1); + public transient AtomicInteger refCount; public Client(UUID session) { + this(session, 1); + } + + public Client(UUID session, int initialRefCount) { + refCount = new AtomicInteger(initialRefCount); this.session = session; timestamp = System.currentTimeMillis(); type = null; From af2155c4bf95bddc2a20584660239e2a54e1d745 Mon Sep 17 00:00:00 2001 From: BartolomeoDR Date: Sat, 16 Oct 2021 14:32:57 +0300 Subject: [PATCH 2/2] [FIX] Fixed user is unable to play after logout Right now refCount value is set to 1, and inside handler.setClient its being incremented to 2. Because of that refCount check never goes to 0, and so current session is never stored ( as only single handler has this client, and not two ). --- .../gravit/launchserver/socket/response/auth/ExitResponse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/ExitResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/ExitResponse.java index 94effdc4..82e17f7f 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/ExitResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/ExitResponse.java @@ -45,7 +45,7 @@ public void execute(ChannelHandlerContext ctx, Client client) { sendError("Exit internal error"); return; } - Client newClient = new Client(null); + Client newClient = new Client(null, 0); newClient.checkSign = client.checkSign; handler.setClient(newClient); AuthSupportExit supportExit = client.auth.core.isSupport(AuthSupportExit.class);