mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-13 03:13:26 -04:00
Added missing flip in ErrorMessage packet, Added null session checks before attempting to login players
This commit should also fix the never-ending "Connecting to Galaxy..." loop. It should also be noted that for some reason any ErrorMessage packet sent before a player is logged in always says that the "Login Server is unavailable at this time".
This commit is contained in:
@@ -92,6 +92,11 @@ public class LoginService implements INetworkDispatch{
|
||||
|
||||
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
|
||||
|
||||
if (session == null) {
|
||||
System.out.println("Login attempted with NULL session!");
|
||||
return;
|
||||
}
|
||||
|
||||
data = data.order(ByteOrder.LITTLE_ENDIAN);
|
||||
LoginClientId clientID = new LoginClientId();
|
||||
data.position(0);
|
||||
@@ -116,16 +121,19 @@ public class LoginService implements INetworkDispatch{
|
||||
err = "user is banned";
|
||||
break;
|
||||
}
|
||||
ErrorMessage errMsg = new ErrorMessage("Invalid Login", err);
|
||||
|
||||
// No matter what, this will always show that the login server is unavailable at this time. Removing the error message will just keep the connecting message up.
|
||||
ErrorMessage errMsg = new ErrorMessage("Wrong Password", "The username or password you entered was incorrect.");
|
||||
session.write(errMsg.serialize());
|
||||
|
||||
Disconnect disconnect = new Disconnect((Integer)session.getAttribute("connectionId"), 6);
|
||||
session.write(disconnect);
|
||||
session.close(false);
|
||||
|
||||
// Closing the session for some reason will not show any error messages, even if write messages are queued..
|
||||
//As result, the infinite "Connecting to galaxy..." loop., also it randomly denies any logins from that client for some reason
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println(user + " successfully logged in.");
|
||||
|
||||
Client client = new Client(session.getRemoteAddress());
|
||||
client.setAccountName(user);
|
||||
client.setPassword(pass);
|
||||
@@ -137,6 +145,16 @@ public class LoginService implements INetworkDispatch{
|
||||
|
||||
core.addClient(session, client);
|
||||
|
||||
if (!core.getActiveConnectionsMap().containsKey(session)) {
|
||||
Disconnect disconnect = new Disconnect((Integer)session.getAttribute("connectionId"), 6);
|
||||
session.write(disconnect);
|
||||
ErrorMessage errMsg = new ErrorMessage("Error Logging In", "Your client could not be added to the connections at this time.");
|
||||
session.write(errMsg.serialize());
|
||||
session.close(false);
|
||||
|
||||
System.out.println(client.getAccountName() + " was not added to active connections map.");
|
||||
return;
|
||||
}
|
||||
/*if(!checkIfAccountExistInGameDB(id)) {
|
||||
createAccountForGameDB(id, user, email, encryptPass);
|
||||
}*/
|
||||
@@ -153,9 +171,7 @@ public class LoginService implements INetworkDispatch{
|
||||
ServerNowEpochTime time = new ServerNowEpochTime((int) (System.currentTimeMillis() / 1000));
|
||||
|
||||
if (client.getSession().containsAttribute("tradeSession") == true) {
|
||||
System.out.println("Has attribute: " + session.getAttribute("tradeSession").toString());
|
||||
client.getSession().removeAttribute("tradeSession");
|
||||
System.out.println("Removed tradeSession Attribute @ LoginService.java");
|
||||
}
|
||||
|
||||
session.write(time.serialize());
|
||||
@@ -165,6 +181,8 @@ public class LoginService implements INetworkDispatch{
|
||||
session.write(serverStatus.serialize());
|
||||
session.write(jediSlot.serialize());
|
||||
session.write(characters.serialize());
|
||||
|
||||
System.out.println(user + " successfully logged in.");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user