Update of /cvsroot/icemud/IceMUD/src/mud/server
In directory sc8-pr-cvs1:/tmp/cvs-serv5885/server
Modified Files:
Connection.java
Log Message:
Server now deals with failed logon attempts correctly.
Index: Connection.java
===================================================================
RCS file: /cvsroot/icemud/IceMUD/src/mud/server/Connection.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Connection.java 12 Dec 2003 18:36:29 -0000 1.9
--- Connection.java 15 Dec 2003 19:28:27 -0000 1.10
***************
*** 70,74 ****
System.out.println("Connection from " + mClient.getSocket().getInetAddress().getHostAddress());
! doLogin();
if (mUser == null) return;
User UTemp = null;
--- 70,76 ----
System.out.println("Connection from " + mClient.getSocket().getInetAddress().getHostAddress());
! if(!doLogin()){
! ServerHandler.removeConnection(this);
! }
if (mUser == null) return;
User UTemp = null;
***************
*** 103,112 ****
}
! private void doLogin() throws SocketException, Exception {
if (mClient == null) {
java.util.logging.Logger.getLogger("warning").logp(java.util.logging.Level.WARNING,
"Connection", "doLogin","[Warning] Socket was null in doLogin()");
! return;
}
--- 105,114 ----
}
! private boolean doLogin() throws SocketException, IOException{
if (mClient == null) {
java.util.logging.Logger.getLogger("warning").logp(java.util.logging.Level.WARNING,
"Connection", "doLogin","[Warning] Socket was null in doLogin()");
! return false;
}
***************
*** 114,124 ****
String user = getNameInput();
! doPlayer(user);
if (mUser != null) {
System.out.println("User " + mUser.getName() + " has just logged in.");
mGUI.setTableValue(mUser.getName() + " playing...", getRow(), 2);
} else {
System.err.println("Error getting user input on Connection "+this.getName());
}
}
--- 116,132 ----
String user = getNameInput();
! if(!doPlayer(user)) {
! mUser=null;
! mClient.doCleanUp();
! return false;
! }
if (mUser != null) {
System.out.println("User " + mUser.getName() + " has just logged in.");
mGUI.setTableValue(mUser.getName() + " playing...", getRow(), 2);
+ return true;
} else {
System.err.println("Error getting user input on Connection "+this.getName());
+ return false;
}
}
***************
*** 238,242 ****
mClient.print("Password: ");
} else {
! mClient.print("Please retype password:");
String sRetype = mClient.readln();
if (sRetype.equals(sPass))
--- 246,250 ----
mClient.print("Password: ");
} else {
! mClient.print("Please retype password: ");
String sRetype = mClient.readln();
if (sRetype.equals(sPass))
***************
*** 300,304 ****
mClient.print(Race.sMenu);
! mClient.print("Race:");
String sRaceChoice = mClient.readln();
--- 308,312 ----
mClient.print(Race.sMenu);
! mClient.print("Race: ");
String sRaceChoice = mClient.readln();
***************
*** 316,320 ****
mClient.print(Classes.sMenu);
! mClient.print("Class:");
String sClassChoice = mClient.readln();
--- 324,328 ----
mClient.print(Classes.sMenu);
! mClient.print("Class: ");
String sClassChoice = mClient.readln();
|