Merge "serverTransition" and "inTransition" fields

They serve the same purpose, no point in separating
This commit is contained in:
P0nk
2024-09-29 07:43:47 +02:00
parent 813768ec47
commit 0a8591aa08

View File

@@ -92,7 +92,6 @@ public class Client extends ChannelInboundHandlerAdapter {
private Hwid hwid; private Hwid hwid;
private String remoteAddress; private String remoteAddress;
private volatile boolean inTransition;
private io.netty.channel.Channel ioChannel; private io.netty.channel.Channel ioChannel;
private Account account; private Account account;
@@ -100,7 +99,7 @@ public class Client extends ChannelInboundHandlerAdapter {
private int channel = 1; private int channel = 1;
private int accId = -4; private int accId = -4;
private boolean loggedIn = false; private boolean loggedIn = false;
private boolean serverTransition = false; private boolean inServerTransition = false;
private Calendar birthday = null; // TODO: convert to LocalDate private Calendar birthday = null; // TODO: convert to LocalDate
private String accountName = null; private String accountName = null;
private int world; private int world;
@@ -237,7 +236,7 @@ public class Client extends ChannelInboundHandlerAdapter {
try { try {
// client freeze issues on session transition states found thanks to yolinlin, Omo Oppa, Nozphex // client freeze issues on session transition states found thanks to yolinlin, Omo Oppa, Nozphex
if (!inTransition) { if (!inServerTransition) {
ctx.fireExceptionCaught(new DisconnectException(this, false)); ctx.fireExceptionCaught(new DisconnectException(this, false));
} }
} catch (Throwable t) { } catch (Throwable t) {
@@ -315,7 +314,7 @@ public class Client extends ChannelInboundHandlerAdapter {
} }
public boolean isInTransition() { public boolean isInTransition() {
return serverTransition; return inServerTransition;
} }
// TODO: load ipbans on server start and query it on demand. This query should not be run on every login! // TODO: load ipbans on server start and query it on demand. This query should not be run on every login!
@@ -603,28 +602,28 @@ public class Client extends ChannelInboundHandlerAdapter {
if (newState == LoginState.NOT_LOGGED_IN) { if (newState == LoginState.NOT_LOGGED_IN) {
loggedIn = false; loggedIn = false;
serverTransition = false; inServerTransition = false;
setAccID(0); setAccID(0);
} else if (newState == LoginState.SERVER_TRANSITION) { } else if (newState == LoginState.SERVER_TRANSITION) {
loggedIn = false; loggedIn = false;
serverTransition = true; inServerTransition = true;
} else { } else {
loggedIn = true; loggedIn = true;
serverTransition = false; inServerTransition = false;
} }
} }
public void setLoginState(int newState) { public void setLoginState(int newState) {
if (newState == LoginState.NOT_LOGGED_IN) { if (newState == LoginState.NOT_LOGGED_IN) {
loggedIn = false; loggedIn = false;
serverTransition = false; inServerTransition = false;
setAccID(0); setAccID(0);
} else if (newState == LoginState.SERVER_TRANSITION) { } else if (newState == LoginState.SERVER_TRANSITION) {
loggedIn = false; loggedIn = false;
serverTransition = true; inServerTransition = true;
} else { } else {
loggedIn = true; loggedIn = true;
serverTransition = false; inServerTransition = false;
} }
} }
@@ -743,7 +742,6 @@ public class Client extends ChannelInboundHandlerAdapter {
// //
public void setCharacterOnSessionTransitionState(int cid) { public void setCharacterOnSessionTransitionState(int cid) {
this.updateLoginState(LoginState.SERVER_TRANSITION); this.updateLoginState(LoginState.SERVER_TRANSITION);
this.inTransition = true;
Server.getInstance().setCharacteridInTransition(this, cid); Server.getInstance().setCharacteridInTransition(this, cid);
} }