Added REQUEST_RECEIVED and DECLINED to ConnnectionStateEnum.

#story[1095]
main
fjc40 8 years ago
parent 41b0a5d7f7
commit 6e5fb62880

@ -19,8 +19,10 @@ import javax.xml.transform.TransformerException;
import java.io.IOException;
import java.net.UnknownHostException;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -70,7 +72,7 @@ public class Event {
*/
public Event(boolean singlePlayer) throws EventConstructionException {
singlePlayer = false;
singlePlayer = false;//TEMP
String raceXMLFile = "mock/mockXML/raceTest.xml";
String boatsXMLFile = "mock/mockXML/boatTest.xml";
@ -154,14 +156,6 @@ public class Event {
public String getAddress() throws UnknownHostException {
return connectionAcceptor.getAddress();
}
public int getPort() {
return connectionAcceptor.getServerPort();
}
/**
* Sends the initial race data and then begins race simulation.
*/
@ -190,7 +184,7 @@ public class Event {
private String getRaceXMLAtCurrentTime(String raceXML) {
//The start time is current time + 4 minutes. prestart is 3 minutes, and we add another minute.
long millisecondsToAdd = Constants.RacePreStartTime + (1 * 60 * 1000);
long millisecondsToAdd = Constants.RacePreStartTime + Duration.ofMinutes(1).toMillis();
long secondsToAdd = millisecondsToAdd / 1000;
//Scale the time using our time scalar.
secondsToAdd = secondsToAdd / Constants.RaceTimeScale;

@ -15,15 +15,26 @@ public enum ConnectionStateEnum {
*/
WAITING_FOR_HANDSHAKE(1),
/**
* The server has receved a {@link network.Messages.RequestToJoin} from the client.
*/
REQUEST_RECEIVED(2),
/**
* The client has completed the handshake, and is connected.
* That is, the client sent a {@link network.Messages.RequestToJoin}, which was successful, and the server responded with a {@link network.Messages.JoinAcceptance}.
*/
CONNECTED(2),
CONNECTED(3),
/**
* The client has timed out.
*/
TIMED_OUT(3);
TIMED_OUT(4),
/**
* The client's connection has been declined.
*/
DECLINED(5);

@ -1,17 +1,6 @@
package shared.model;
import network.Exceptions.InvalidMessageException;
import network.MessageEncoders.RaceVisionByteEncoder;
import network.Messages.AC35Data;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.logging.Level;
import java.util.logging.Logger;

Loading…
Cancel
Save